[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue: DECLARE-TYPE-FREE (Version 5)

    Date: 30 Sep 88 21:33 PDT
    From: masinter.pa@Xerox.COM

    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.

    Issue:         DECLARE-TYPE-FREE
      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

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,
   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
   bad style...