2 ms·
> typedef int Tcl_CmdProc(ClientData clientData, Tcl_Interp * interp, int argc, const char * argv[]); > IE, just standard "main()
by bch 11y ago
> typedef int Tcl_CmdProc(ClientData clientData, Tcl_Interp * interp,
int argc, const char * argv[]);
> IE, just standard "main()" style code with a couple extra args. (The newer Tcls have a new API that doesn't use strings for everything but that's a little more complicated).
Tcl "Objects" (versus the pure string implementation) do honour the power, simplicity and "spirit" of Tcl just as well as your string example...
int myCommand (ClientData clientData, Tcl_Interp * interp, int objc, Tcl_Obj * const objv[])
The "objects" (I quote this for a reason) are not object-oriented constructs, but a compound structure (we're talking the internal C implementation here...) to manage what a Tcl component is. The computing model is (and always has been) "Everything is a string (eias)", which is to say, there are no ints, floats, chars, etc in Tcl -- just strings. Non-string values are coerced correctly at runtime. With an object though, the "native" value for an entity is stored internally so that it doesn't have to be computed at every access. So, storage that is "9" will have (int)9 tucked away in the Obj if one is doing integer work with it. If you switch to float, it will have 9.0... you'll have fast access to the computed native value as long as you don't interleave accesses that want a different native type -- such as trying to retrieve an int, then a float, then an int, then a float... in this case, the objects "shimmer", in Tcl parlance.
Like a lot of things Tcl (which has a long history), much of peoples recollections come from a long time ago... in this case, the new object (versus pure string) representation came into effect in 1999[0] with Tcl 8.0.
In my opinion, the objects are just as easy to use as strings, and bring some nice performance improvements to the table. Otherwise, Tcl is still as fun to use today as it's always been, while it's also getting interesting tweaks and additions as time goes on.
[0] http://www.tcl.tk/software/tcltk/8.0.html#What%27s%20New%20in%20Tcl%208.0 http://www.tcl.tk/software/tcltk/8.0.html#What%27s%20New%20i...
Edit: formatting