Why is tcl broken?

Marco Antoniotti marcoxa at copernico.parades.rm.cnr.it
Wed Jun 30 07:21:06 EDT 1999


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

> Marco Antoniotti wrote:
> > 
> > Nope. *best* is the Common Lisp Macro system, with Scheme/Dylan syntax
> > stuff a second best.  The notion of 'upvar' in Tcl makes my head
> 
> I am surprised at this because Tcl's [upvar] is simply an explicit form
> of dynamic binding which I seem to remember is what Lisp uses. (That
> is how the 'let' function can be (is) implemented as a lambda
> function).

Ahem!  LET is essentially a macro built on top of LAMBDA application.
Dynamic binding is another beast altogether, which Common Lisp and
Scheme (statically scoped languages) allow in through a back door.
The notion of [upvar] and [uplevel] (with the optional numeric argument which allows
you to inspect N levels of stack is truly hackish.  The utility of
this construct is not in question.  But its use as a
'macro-approximating' device is questionable.

BTW. Is TCL statically or dynamically scoped?

> > spin. :) Finally, AFAIU, a Tcl "macro" must run as an interpreter of
> > the spec. A Common Lisp (Scheme) macro is compiled into regular code
> > by read-time expansion.
> > 
> 
> I find that Lisp macros (while a very powerful and necessary mechanism)
> are sooo confusing. They are in essence another language inside Lisp,
> and as such introduce inconsistencies.

You are very mistaken.  Common Lisp macros are definitively not
another language.  They manipulate S-expressions, which are what Lisp
is made of.  They generate inconsistencies insofar as you are careless
when dealing with possible name capture problems. GENSYM and GENTEMP
are there to help you.

> Tcl on the other hand doesn't
> need a macro language and as such is much more consistent than Lisp.

You severely underestimate the power of Common Lisp (Scheme and Dylan)
macro systems and ascribe to them inconsistencies which are not
there.  It is true that Tcl does not need a macro system. But mostly
because, since you have Common Lisp, you do not need Tcl altogether :)
Apart from some good ole flaming, why doesn't Tcl need a Lisp style
macro system? Just because you have [eval]?  Not a very good
argument. Especially when brought up in front of a Lisp audience.

> 
> If I needed a macro language in Tcl I can just write one.

I just recieved an email from Cameron Laird, citing a 'procm' form in
Tcl, which is supposed to do 'scan time' macros - probably something
in line with the real thing. However, the manual pages for 8.1 at Scriptics
does not mention it.  Yet, I suppose that it is still an experimental
feature that maybe will appear in Tcl in a later edition - a few
lustres after Lisp had them :)

> Lisp and Tcl have a lot more in common than Lispers seem to want to 
> acknowledge.

Ahem!  Do you remember the "revised" Tcl paper by Ousterhout (sorry
for the spelling mistakes :) ), where the essential
addition/correction was the mention of the L-word? :)

Cheers

-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa




More information about the Python-list mailing list