An implicit {*}$ prefix

Given Tcl 8.5's {*} expand feature, and an earlier thought experiment about adding a leading $ to every command, 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.

JJS: Isn't this a lot like interp alias?

interp alias {} obj {} ...      ;# instead of set obj {...}
set result [obj arg1 arg2 arg3] ;# works like {*}$obj

NEM: The difference is that variables can be local to a procedure whereas aliases can't. With apply you can now have procedures that are stored in local variables, but not commands in general, and the syntax could be better. I wrote some thoughts about ways to accomplish the same thing in a hypothetical Tcl 3000 here [L1 ].


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