Why is tcl broken?

Tom Breton tob at world.std.com
Thu Jul 1 19:55:25 EDT 1999


Paul Duffin <pduffin at mailserver.hursley.ibm.com> writes:

> Please enlighten me as to what my misconception is. I am obviously not
> a Lisp expert and I realise that there are plenty of different flavours
> around but the above code works inside Emacs which says that it is
> based on Common Lisp.
[...]
> > 
> > >         (defun inner (b)
> > >           (+ a b))
> > >
> > >         (defun outer (a)
> > >           (inner 3))
> > >
> > >         (outer 2)

In elisp, all variables are "special", which is to say, dynamically
scoped.  Thus inner can find "a" even tho "a" is declared in outer.
This is not so in Common Lisp.

> > > A simple macro version of setq would convert from
> > >         (setq symbol '(list))
> > > to
> > >         (set 'symbol '(list))
[...]
> > > A macro setq is not interpreted the same way as set is because if it
> > > was an error would occur when the Lisp interpreter tried to get the
> > > value of the variable symbol before symbol was created.

What seems to be the problem?  An error in the timing of symbol
dereferencing isn't it.  Perhaps you are thinking of some other macro
system, not Lisp's.

BTW, In elisp which you refer to, there is no problem with setting a
new symbol, (set 'a-new-symbol some-value), because intern both looks
up a symbol and creates it if it doesn't find it.  

-- 
Tom Breton, http://world.std.com/~tob
Ugh-free Spelling (no "gh") http://world.std.com/~tob/ugh-free.html




More information about the Python-list mailing list