Re: [TCLCORE] Variable access (was Re: [Tcl9-cloverfield], Parser)
by Larry McVoy other posts by this author
May 9 2008 6:31AM messages near this date
Re: [TCLCORE] Variable access (was Re: [Tcl9-cloverfield], Parser)
|
Re: [TCLCORE] Variable access (was Re: [Tcl9-cloverfield], Parser)
> I believe Fr?d?ric is suggesting that it is equivalent to an implicit
> upvar on the name (in the scope of the called proc), but guarantees that
> the variable exists. Using upvar currently provides no such guarantee
> because the variable name is a weak reference.
> > proc foo v { ... }
> > foo $&bar
> >
> > is roughly equivalent to:
> >
> > proc foo vName { upvar 1 $vName v; ... }
> > foo bar
> >
> > Is that correct?
This is very similar to what we already have implemented in L. The &var
syntax is just syntatic sugar for the implied upvars as needed in the
callee; the caller, it means pass the name of the variable instead of
the value.
Seems to work quite well.
--
---
Larry McVoy lm at bitmover.com http://www.bitkeeper.com
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Twylite
Larry McVoy
Rna020
Neil Madden
Twylite
Neil Madden
Twylite
Neil Madden
|