Why is tcl broken?

Marco Antoniotti marcoxa at copernico.parades.rm.cnr.it
Tue Jun 29 11:39:41 EDT 1999


> Delivery-Date: Tue, 29 Jun 1999 17:28:08 +0200
> Date: Tue, 29 Jun 1999 10:30:14 -0500 (CDT)
> From: Cameron Laird <claird at Starbase.NeoSoft.COM>
> Newsgroups: comp.lang.python,comp.lang.lisp,comp.lang.scheme
> Organization: NeoSoft, Inc. +1 713 968 5800
> content-length: 645
> 
> In article <lw67471fyi.fsf at copernico.parades.rm.cnr.it>,
> Marco Antoniotti  <marcoxa at copernico.parades.rm.cnr.it> wrote:
> 			.
> 			.
> 			.
> >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.
> 			.
> 			.
> 			.
> Are you making a semantic point, or arguing
> on the basis of implementation-specific per-
> formance?

It is (mostly) a semantic point.

> If the latter, please be aware
> that the Tcl community is actively investi-
> gating dramatic speedups of [eval].

I have no problems with that.  But the following example is pretty
hard to beat. :)

==============================================================================
* (defmacro zut (a) `(list ,a))
ZUT

* (defun zot (x) (zut x))
ZOT

* (compile 'zot)
ZOT

* (disassemble 'zot)
071B5790:       .ENTRY ZOT(x)                ; (FUNCTION (T) LIST)
     7A8:       ADD   -18, %CODE
     7AC:       ADD   %CFP, 32, %CSP

     7B0:       CMP   %NARGS, 4              ; %NARGS = #:G0
     7B4:       BNE   L0
     7B8:       NOP
     7BC:       MOVE  %A0, %A4               ; %A0 = #:G1
     7C0:       MOVE  %A4, %A0               ; No-arg-parsing entry point
     7C4:       ADD   4, %ALLOC
     7C8:       ANDN  %ALLOC, 7, %A3
     7CC:       OR    3, %A3
     7D0:       MOVE  %A3, %A1
     7D4:       ST    %A0, [%A1-3]
     7D8:       ST    %NULL, [%A1+1]
     7DC:       TADDCCTV 4, %ALLOC
     7E0:       MOVE  %A3, %A0
     7E4:       MOVE  %CFP, %CSP
     7E8:       MOVE  %OCFP, %CFP
     7EC:       J     %LRA+5

     7F0:       MOVE  %LRA, %CODE
     7F4:       UNIMP 0
     7F8: L0:   UNIMP 10                     ; Error trap
     7FC:       BYTE  #x04
     7FD:       BYTE  #x19                   ; INVALID-ARGUMENT-COUNT-ERROR
     7FE:       BYTE  #xFE, #xED, #x01       ; NARGS
     801:       .ALIGN 4
* 
==============================================================================

Of course I could have defined a much more intricated macro.

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