I have a few questions on Snit objects (see: http://wiki.tcl.tk/2831 for some details - the example near the end)
1. Is it possible to _clone_ an object?
I ask because I want to "chain" methods from various
objects. In my example: to combine different
transformations into a single one.
2. Is the command install only available at creation
time? If not, I would like to use it to vary the
components after the object has been created, to
make its behaviour more dynamic.
3. Is the delegate command only available when
defining the type?
(The reasons for questions 2 and 3 are that I would like
some dynamic behaviour of the objects, beyond options
and variables. Mostly, perhaps, because I am
experimenting with Snit, to get a feel for the style
of programming)
Ad 1. Cloning is essentially a serialize+deserialize operation. Using snit introspection it should be possible to automate basic support for this, maybe even in a snit::macro. Note, this implies that currently there is no such support in snit, AFAIK. Now further, if the object to clone is more complex, like using timers, sockets, files, i.e. any type of state which is not stored directly in the object, the basic clone will not be enough. For these cloning will need custom written support code which handles all the complex parts.
Ad 1. The struct::{graph,tree} structures in Tcllib, while not based on snit, contain '(de)serialize' methods, fully custom written, and assignment/copy methods on top, even with support for copy during construction.
Ad 2. No idea, defering to Will for that.
Ad 3. No idea, defering to Will for that.