[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issue: DECLARE-TYPE-FREE (Version 5)
- To: masinter.pa@Xerox.COM
- Subject: Issue: DECLARE-TYPE-FREE (Version 5)
- From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Sat, 1 Oct 88 16:36 EDT
- Cc: email@example.com
- In-reply-to: <880930-213354-1766@Xerox>
Date: 30 Sep 88 21:33 PDT
I think this is ready for release. Complain soon if you don't.
Sorry, but I have two comments which I think should be addressed before
this goes out.
A style note might add that since nested type declarations intersect,
it would be bad style to have inner declarations be subtypes of the outer
ones. For example
(locally (declare (type x fixnum))
(locally (declare (type x (or bit package)))
(setq x 1)))
would be confusing. Such code might be generated by macros, however.
This example is buggy because the syntax of TYPE declarations should have
the type first and the variable second. You want
(TYPE FIXNUM X)
(TYPE (OR BIT PACKAGE) X)
Anyway, I find this remark about the style note confusing. FIXNUM is not
a subtype of (OR BIT PACKAGE) nor vice versa. There are two cases of
- The outer declaration is a subtype of the inner. eg,
(LOCALLY (DECLARE (TYPE FIXNUM X))
(LOCALLY (DECLARE (TYPE NUMBER X))
which is redundant but harmless. I don't think it's anything to
stylistically discourage though.
- The outer declaration is not a subtype of the inner, and vice versa.
That is, the two types only partly overlap (or don't overlap at all).
You've already discussed the case of no overlap above in the Discussion,
so there's no point in repeating the remarks here. Instead, I'd just
deal with your example, which illustrates the interesting case of
only partially overlapping types. The case is interesting, but I'm a
little worried even here that "bad style" translates to "a compiler
should warn about this" and since, as you say, a macro might legitimately
expand into this, I think it's a very bad idea to identify it as