Version 8 of An implicit {*}$ prefix

Updated 2007-09-18 13:16:53 by dkf

Given Tcl 8.5's {*} expand feature, and an earlier thought experiment about adding a leading "$" to every command (can't recall what wiki page this was) ...

What would a system be like if it worked as follows - this notation:

    set obj {...}
    set result [obj arg1 arg2 arg3]

... would behave as if it had been written as follows in Tcl 8.5:

    set obj {...}
    set result [{*}$obj arg1 arg2 arg3]

It obviously wouldn't be Tcl, since the variable and command namespace get mixed up when you start doing this.

But suppose you didn't care (Tcl 3000!) - would it be useful? convenient? worth looking into?

MJ - I am not seeing the use for the implicit $, is it so much trouble to write [$obj arg1 arg2 arg3]? Autoexpansion of the leading word would be very useful however (especially in OO type constructs and functional programming).

It seems you are suggesting unification of variables and procs, which sounds a lot like the concept of slots in Self, in that case $ will become unnecessary. Getting the value of a var is simply [var].

DKF: This idea ("auto expand leading word") has been known about and discussed (on and off, when we've nothing else to do) for years.


RS: See Let unknown know how to tweak Tcl that it does auto-expansion of leading word... :^)


Category Discussion | Category Design | Category Syntax