Subject: Re: Declarations in LET*
From: Erik Naggum <erik@naggum.no>
Date: 11 Oct 2002 00:00:34 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3243283234727557@naggum.no>

* Edi Weitz <edi@agharta.de>
| Yes, I would have expected this to signal an error because *A* isn't
| bound when FOO is called[1], i.e. *A* is only declared to be special in
| the body of the second LET form but not in its init-form. A quick test
| with CMUCL, AllegroCL, and CLISP shows that they seem to agree with me.

  Good answer.

| What caused my initial confusion was that it wasn't clear to me that (and
| why) the same thing doesn't happen in BAR-2 above.  After having been
| pointed to 3.3.4 in the CLHS and after reading about the scope of the
| variables in a LET* form I _think_ that I now understand what's going on.
| Or am I still wrong?

  I think the most important issue here is that there is only one `declare´
  statement that might apply, and since bindings are made in sequence
  rather than in parallel, that should apply to the declarations, too.

| Maybe I should add that I loaded the three DEFUNs above into a fresh
| image, i.e. there was no DEFPARAMETER or DEFVAR before which made *A*
| globally special. Now that I think of it I'm not so sure anymore whether
| the convention of enclosing variable names with asterisks applies to all
| special variables or only to those which are _globally_ special.

  Well, I hunt for the `defvar´ or `defparameter´ when there are *'s around
  a variable name and think they should not be used when the variables so
  used are "internal".

| [1]: I take it that you meant *A* and not A and that the asterisks got
|      lost somehow, either in my Emacs or yours due to Gnus' somewhat
|      peculiar behaviour.

  Amusingly, you are quite correct about the *boldface* thing in Gnus.
  Maybe we should convince the world to use a rich language to communicate
  font details and such, but these days that would be something ending in
  ML and it is probably better to uninvent that whole thing and get rid of
  the desire to use boldface.  There is a reason why I use /italics/.

-- 
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.