'''Background''' TIP #144 ''Argument Expansion Syntax'' [http://www.tcl.tk/cgi-bin/tct/tip/144.html] (and the earlier TIP #103 ''Argument Expansion Command'' [http://www.tcl.tk/cgi-bin/tct/tip/103.html]) proposes to add syntax to Tcl to perform argument expansion in a safe and efficient manner. For example, instead of having to write: eval [linsert $args 0 exec $program] The TIP would allow one to say: exec $program {}$args where the leading '''{}''' indicates that the remainder of the word shall be parsed as a list (after applying the usual substitution rules), and each element of the list is passed as a separate argument to the command. Naturally, there has been a great deal of discussion about what syntax should be used to indicate argument expansion. The two most popular options seem to be {} and ` (backquote). The main advantage of the {} syntax is that it can be added to Tcl 8.5 without breaking backwards-compatibility, as such usage is currently a syntax error. Any other option would have to wait until Tcl 9.0. A similar poll was conducted on the tcl-core mailing list. The result is on the [Argument Expansion Poll Summary] page. '''Poll''' The purpose of this poll is to get a feel for the Tcl community's preferences regarding the proposed syntaxes. The poll is in two parts: the first asks which syntax would be preferable ''if backwards compatibility were not an issue''. The second asks if the backwards-compatible syntax would be acceptable if it meant the feature could be introduced earlier. Please vote by signing your name or initials after the proposed option. Discussion moved to [DISCUSSION: Argument Expansion Syntax] '''Part 1: which syntax do you prefer?''' ''Option 1: leading {}'': [Vince], [RS], [Roy Terry], [Jeffrey Hobbs], [EB], [Andreas Leitgeb], [JMN] ''Option 2: leading `'': [Joe English], [ramsan], [SO], [US], [MC], [NEM], Heiner Marxen ''Option 3: other (please specify)'': * ''leading {expand}'' [DGP], [Daniel Steffen], [MS], [KBK], [Peter Spjuth], [de], [Donald Arseneau], [JBR] * ''$$foo'', ''$[[foo]]: [Lars H] * ''[[expand ]]'' If someone can do it: [Steve Redler IV], [MAK], [Peter De Rijk], [TR], [Jacob Levy], [TP], [davidw], [Salvatore Sanfilippo], [PT], [Joe Mistachkin], [TFW] * ''^^$foo and ^^[[foo]]'' : [Setok] * Added functionality to Tcl that allows "macro" commands: commands can edit the calling command line. Dangerous in a semi-Tclish fashion. F.ex. file join [[expand $MyList]] : [Setok] Scott Gargash, [Joe Mistachkin] (see [lconvert]), [MAK] (Well, I'm confused by the different "expand" options. See [http://sourceforge.net/tracker/index.php?func=detail&aid=781929&group_id=10894&atid=310894]: same idea, but simpler than lconvert.) * paired backquotes meaning eval and expand (see [Discussion: Argument Expansion Syntax]): Scott Gargash * add switch to eval to control expansion of args. [Larry Smith], [Joe Mistachkin] eval arg1 arg2 arg3 arg4 arg5 ; same as before - expands all args eval -only { arg4 } ; expands arg 4 eval -only { arg1 to arg3 } ; expand arg 1 to arg3 eval -- -only arg2 ; -- turns off switch processing, -only just another arg to expand * '''Just use a postfix *''' As in cmd $*var or [[*cmd]] , has small impact on backwards compatibility. This syntax places expansion back at the parser backend where it has already detected special chars of either $ or [[. [PWQ] [MSW] (although I prefer ruby's *[[cmd]] or *$var) ''Option 4: neither'': marc, THIRION, [lv] (as long as it truly can be provided as a command) [George Peter Staplin], [Jacob Levy]: (It has proven to be simple enough to implement ''expand'' in pure Tcl. Therefore I feel that neither is worthy of the trouble.), Bradipo ''Option 5: anything, just give me the functionality'': [KPV], [Andreas Leitgeb], [schlenk] ''Option 5a: anything that gives the functionality but which isn't too ugly and which won't be too typo-inclined'': [DKF], [rmax], [ulis] '''Part 2: Is {} acceptable for Tcl 8.5?''' ''Yes, {} is acceptable'': [DGP], [Vince], [Daniel Steffen], [RS], [KBK], [Peter Spjuth], [Roy Terry], [EB], [Andreas Leitgeb], [DKF] (if we must), [NEM], Heiner Marxen, [JMN], [Lars H] ''Yes, ` is acceptable (never mind the slight chance of breakage)'': [US], [DKF] (if we can stand that much subtle incompatability) ''Yes, [[expand]] is acceptable, and it is also back-portable to older Tcl versions (noone yet came up with a convincing argument that required additional syntax and was not doable with a command)'': [Jacob Levy], [Steve Redler IV], [TP], [PT], [Joe Mistachkin], [JBR], [TFW] ''Yes, -only is acceptable'': [Larry Smith] ''Yes, anything is acceptable'': [KPV], [ulis] [MSW] ''No, wait until Tcl 9 to add the feature'': [Joe English], marc, THIRION, [SO], [Setok], [schlenk], Scott Gargash, [MC], [rmax], [davidw], [Salvatore Sanfilippo] ''Not if this functionality can be achieved in some other manner'': [lv], [Jacob Levy], [Joe Mistachkin] (seems it can be implemented as a command) ''No, we do not need this functionality'': --- ''Just skip Tcl version 8.5 and release v9 as next version'': [ramsan] I'm cool w/this, too. [Larry Smith] [Setok] ''Skipping Tcl 8.5 would be a horrible thing to do'': [Joe Mistachkin] ''If a new syntax rule is added in 8.5, it should be permanent. No new different rule for 9.0'' [Clif Flynt]