Subject: Re: Handling declarations
From: (Rob Warnock)
Date: Fri, 28 Jul 2006 21:54:29 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Lars Brinkhoff  <> wrote:
| (Rob Warnock) writes:
| > (defmacro my-let-if (condition bindings &body (forms decls))
| >   (multiple-value-bind (binding-decls other-decls)
| >       (split-decls bindings decls)
| >     `(if ,condition
| >        (let ,bindings ,@binding-decls ,@other-decls ,@forms)
| >        (locally ,@other-decls ,@forms))))
| >
| > where SPLIT-DECLS is left as an exercise for the reader.  ;-}  ;-}
| was really this SPLIT-DECLS I was hoping to read more about.

Well, it seemed sort of obvious, but I was in a rush [and don't
need it myself], so I waved the "exercise for the reader" magic wand.  ;-}
Basically, I supposed that SPLIT-DECLS would trundle down the list
of DECLS looking for any that applied to (MAPCAR #'CAR BINDINGS),
and separate those out. There's a bit of scut work to do there,
making sure you handle all the variations of declaration syntax,
but my gut feel is that it's maybe 0.5-1.0 pages of code.

| Though actually, I think getting all declarations relating to some
| specific variable (or list of variables) might be more useful.

If you do that sort of thing often, then this is certainly
the sort of routine you would want to have around.  ;-}

| Of course, it's hard to handle implementation-specific and
| user-defined declarations.

Indeed! I was blithely ignoring that.


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607