Why is tcl broken?

Gareth McCaughan Gareth.McCaughan at pobox.com
Thu Jul 1 12:35:39 EDT 1999


Paul Duffin wrote:

>>> Mistake, I think I meant dynamic scoping.
>> 
>>> (defun inner (b)
>>> (+ a b))
>>> 
>>> (defun outer (a)
>>> (inner 3))
>>> 
>>> (outer 2)
>> 
>>> 
>>> A simple macro version of setq would convert from
>>> (setq symbol '(list))
>>> to
>>> (set 'symbol '(list))
>> 
>> All 3 the same instance of the first misconception.
>> That's OLD, BROKEN Lisp!!
> 
> 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.

Emacs is not based on Common Lisp. Common Lisp is not dynamically
scoped (though you can request specific variables to be scoped
dynamically).

The other main modern Lisp dialect, namely Scheme, is also not
dynamically scoped.

Old versions of Lisp were dynamically scoped because the first
Lisps were interpreted only and it's easier to do dynamic scoping
than lexical scoping in an interpreter. But with dynamic scoping
it's hard to get really good compiled code, and modularity is
harder too (because any function you call can mess with your
variables). So recent Lisps have switched to lexical scoping.

Emacs Lisp, however, is not a recent Lisp.

-- 
Gareth McCaughan            Dept. of Pure Mathematics & Math. Statistics,
Gareth.McCaughan at pobox.com  Cambridge University, England.




More information about the Python-list mailing list