Version 18 of {*}

Updated 2006-12-17 21:54:21 by dkf

The artist formerly known as {expand}. See TIP 293 [L1 ] for details.

RLH This is much better IMHO.

jcw - HURRAY!

RS Note that in re_syntax, * stands for "zero or more", which is exactly the unique cardinality of an {expand}ed item...

DKF: Similarly in string match syntax.


SYStems I vote yes. I don't think though that its necessary to deprecate {expand}, but I agree on deprecating {} it does look like syntax error rather than a feature.

RLH I think {expand} should be removed completely. It is not in the language "official" yet and so it should be yanked to make sure no abuse occurs.

JMN Well.. {*} looks to me like a nipple.. which is clearly better than a wart.


CN slightly regrets that {expand} is now gone - I was looking forward for possible future enhancements along the same line, like for example

   lappend mylist {sort|toupper|regmatch [0-9]+}$somelist

to specify a chain of filters for the expansion. But I suppose that people for whom {expand} is a wart will classify this a as a tumor... ;-)

DKF: It's also trivially replacable using {*}[...] and some commands to preprocess the list.


SYStems or you can just

   lappend mylist {*}[lsort [string toupper [regmatch {[0-9]+} $somelist]]]

moral is {*} is not a shorthand for other commands, its a new feature, although for this particular example you could have just used

 set mylist [concat $mylist [lsort [string toupper [regmatch {[0-9]+} $somelist]]] ]

For the impatient, see Expansion with {*} in Tcl 8.4


[Category Syntax|Dodekalogue]