|
|
|
|
|
by dkfellows
3492 days ago
|
|
The usual problem is to do with managing list construction, and the usual answer is the [list] command, which Does The Right Thing for sane code. We also made sure that such lists go through the script evaluation engine cleanly (except for the first word, which will be forced to be interpreted as a command name, obviously). I think we (well, mostly me in this case) sorted this out properly in 8.5. Still, we don't recommend tying objects with important lifetimes to values; Tcl really assumes that it can clone and release them as it sees fit (and effectively that it can interconvert through the serialization without problems). It's a pretty different design decision to what most programming languages go with, and has a lot of consequences, some really good and some quite irksome at times. There's quite a few extension packages that do the sort of thing you're talking about without trouble. In particular, the packages for handling talking to DOM trees, DCOM interfaces, and JVMs all take this approach without becoming disaster zones. Another approach is to put the magical value in a variable and refer to that variable by name (which is a bit more easily done when it is an array element). I'm sure something could be worked out. |
|