Version 77 of POLL: Argument Expansion Syntax

Updated 2003-07-31 19:38:58

Background

TIP #144 Argument Expansion Syntax [L1 ] (and the earlier TIP #103 Argument Expansion Command [L2 ]) 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, lv, SO, US, MC, NEM, Heiner Marxen

Option 3: other (please specify):

Option 4: neither: marc, THIRION, George Peter Staplin: (It has proven to be simple enough to implement expand in pure Tcl. Therefore I feel that neither is worthy of the trouble.)

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

Yes, ` is acceptable (never mind the slight chance of breakage): lv, 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

Yes, $() is acceptable: Larry Smith

Yes, anything is acceptable: KPV, ulis

No, wait until Tcl 9 to add the feature: Joe English, marc, THIRION, SO, Setok, schlenk, Scott Gargash, MC, rmax, davidw, Salvatore Sanfilippo

No, we do not need this functionality: ---

Just skip Tcl version 8.5 and release v9 as next version: ramsan