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

special var type decls



Here's something that the Common Lisp clean-up committee might want to
consider for clarification:
Is the following legal?

  (PROCLAIM '(TYPE NUMBER *X*))
  (DEFVAR *X*)
  (DEFUN FOO ()
     (LET ((*X* T))
	(DECLARE (TYPE SYMBOL *X*))
	(BAR)))

Page 156 of Steele says that a proclamation is "always in force unless
locally shadowed" and page 158 says type declarations "only affect
variable bindings", which might be interpreted to mean that the DECLARE
locally shadows the PROCLAIM.  However, that interpretation would make
the global type proclamation useless because it could not be relied on
when compiling a function such as BAR.  Consequently I would be inclined
to say that the above example is an error.  That still leaves a question
of whether local type declarations for special bindings should be
permitted if they specify a subtype of the globally proclaimed type, or
whether (DECLARE (TYPE ...)) is only meaningful for lexical variables.

Another example of ambiguity regarding global versus local declarations
is that section 9.2 of Steele begins "Here is a list of valid
declaration specifiers for use in DECLARE." What about PROCLAIM?  Does
that imply that FTYPE cannot be used in a PROCLAIM since it is not
explicitly mentioned under the PROCLAIM function?  On the other hand,
IGNORE doesn't make sense in a PROCLAIM, but it doesn't explicitly say
that it can't be used there.

  -- David Gray