Re: [TCLCORE] TIP #157: Argument Expansion with Leading {expand}
by =?ISO-8859-1?Q?Fr=E9d=E9ric_Bonnet?= other posts by this author
Sep 24 2003 3:41PM messages near this date
Re: [TCLCORE] TIP #157: Argument Expansion with Leading {expand}
|
Re: [TCLCORE] TIP #157: Argument Expansion with Leading {expand}
Donald G Porter wrote:
> Here's a thought to consider.
>
> Given that the poll says only a solution targetted for 9.0 will be
> accepted, an incompatibility (preferably as small as possible) is
> permitted.
>
> So we could combine the word-prefix-syntax architecture of {expand}...
> with the use of the somewhat more eye-pleasing prefix $* .
>
> In current Tcl, a word that begins with literal $* will also begin with
> literal $* after substitution. If we made use of $* as the expansion
> prefix for a word in Tcl 9, then anyone expecting literal $* would be
> forced to produce it via some substitution. For example,
>
> set punctuation $*&!^@#
>
> would have to become something like
>
> set punctuation \$*&!^@#
> or
> set punctuation \u0024*&!^@#
>
> That's the extent of the incompatibility. Probably less impact than
> choosing ` . Perhaps less than the :: in command names incompatibility
> from the 7 -> 8 transition.
>
> Otherwise the modified proposal would be the same as TIP 157. Just
> replace the prefix string {expand} proposed there with the prefix
> string $* .
Maybe that would be the occasion to introduce double/multiple
substitution, i.e
set foo 1
set bar foo
puts $$bar
=> 1
Currently this yields
puts $$bar
=> $foo
If we choose to extend the semantics of $ substitution at the price of
some incompatibility, then at least let's push the idea to its limits. I
don't know what it implies WRT the Endekalogue, though.
OTOH this doesn't solve command expansion, i.e {expand}[command
args...]. I don't think *[command args...] is an option, as it may clash
badly with expr. The {expand} syntax is nice and consistent on this
point, as it applies at the beginning of all words. Sorry but I don't
get the point about its supposed ugliness; as a user I find it perfectly
readable and explicit (much more than having to decipher or - aargh -
write eval/list/lrange voodoo).
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Donald G Porter
=?ISO-8859-1?Q?Fr=E9d=E9ric_Bonnet?=
|