From: Hannu Koivisto
Subject: Walking let* with the CLtL2 syntactic environment access interface?
Date: 
Message-ID: <87oe7nksa6.fsf@trews52.bothi.fi>
Greetings,

I'm trying to figure out whether the said interface (issue
SYNTACTIC-ENVIRONMENT-ACCESS:RETRACTED-MAR91 in the HyperSpec,
section 8.5. Environments in CLtL2) could be used to walk LET*
forms properly.  It seems to me it couldn't be, but I might be
missing something.

Let's say we have a LET* form like this:

(let* ((a a-init-form)
       (b b-init-form))
  (declare decl-spec-1 decl-spec-2 ...))

As far as I can see, the scope of binding A includes B-INIT-FORM
which according to 3.3.4. (in HyperSpec) means that the scope of
the bound declarations that apply to A includes B-INIT-FORM as
well.  On the other hand, the scope of free declarations and bound
declarations that apply to B does not include B-INIT-FORM.

So for walking B-INIT-FORM the "current" environment should be
augmented with variable A and bound declarations that apply to it.
But how do I find out which DECL-SPEC-<n>s are bound declarations
and apply to A given that new declarations can be added with
DEFINE-DECLARATION?  It seems to me that if there was a way to call
declaration handlers defined with DEFINE-DECLARATION, that would
solve the issue.  But there isn't; the implementation of
DEFINE-DECLARATION simply has to be compatible with the
implementation of AUGMENT-ENVIRONMENT and the way they communicate
isn't exposed in the interface.

Any thoughts?

-- 
Hannu