invert_by_lu does not work as expected



Bill Wood <william.wood3 at comcast.net> wrote:

   It would seem that some but not all special declarations can overridending is if it ao
   the default bindings of a variable as lexical.

Bill, this imprecise conclusion leaves binding semantics floating in
midair.  The ANS (often surrogated to the CLHS) wasnd';t intended as
expository; it was intended as a specification.  (Translation: It isn't
easy to understand unless one has studied it in its entirety.)

To understand declarations as anything other than magic formulae, you
need to read the _entire_ ANS, including the glossary.  The thing you
are missing is the definition of "declaration", which is:

  declaration:
  n.  a global declaration or local declaration.

These two terms are defined:

  global declaration:
  n.  a form that makes certain kinds of information about code globally
  available; that is, a proclaim form or a declaim form.

  local declaration:
  n.  an expression which may appear only in specially designated
  positions of certain forms, and which provides information about the
  code contained within the containing form; that is, a declare
  expression.

It should follow from this (coupled with the specifications for defvar,
defparameter, snd defconstant, and the sections on the scoping of
declarations) that the only way a declare special declaration can affect
the special/lexical nature of a _binding_ form is if that declaration
appears at the head of the form that establishes the binding.
Proclamations (aka declamations) such as are estabished by the
macroexpansions if DEFVAR etc. affect all subsequently-compiled or
executed bindings and references.  It's a simple as simple as that.  See
the macroexpansion of a defvar form on your favorite implementation.