Why is tcl broken?

Paul Duffin pduffin at mailserver.hursley.ibm.com
Fri Jun 11 13:59:27 CEST 1999


Fernando Mato Mira wrote:
> 
> Bob Techentin wrote:
> 
> > These flame wars are more than five years old.  Tcl has had namespaces
> > and a byte-code compiler for years.
> 
> I know that. But I see some serious things there (the `call by name' issue,
> for example) that give me the impression must be still around unless
> the semantics have gone through a major change.
> 
> I would cut this thread right here before someone comes up
> with some myth. There's enough work for debunkers there.
> 
> Thanks,

Tcl does not have 'call by name' semantics.
In fact its calling semantics are remarkably like C's.

    C only supports call by value
    Tcl only supports call by value

    In C if you want to pass a "reference" you pass a pointer
    In Tcl if you want to pass a "reference" you pass a variable name

"Call by name" has some very particular characteristics the main one
being that you cannot implement "swap". I can assure you that you can
write a swap function in Tcl.

	proc swap {&a &b} {
	    upvar ${&a} a
	    upvar ${&b} b

	    set t $a
	    set a $b
	    set b $t
	}

-- 
Paul Duffin
DT/6000 Development	Email: pduffin at hursley.ibm.com
IBM UK Laboratories Ltd., Hursley Park nr. Winchester
Internal: 7-246880	International: +44 1962-816880




More information about the Python-list mailing list