[Xotcl] aggregate objects with autoname

Kristoffer Lawson setok at fishpool.com
Sun May 27 02:16:00 CEST 2001


I'm proposing an object method "createAsChild", or something similar. The
syntax would be:

createAsChild <class> ?arg0 arg1 ...?

This would basically be a convenience method to do the equivalent of
creating an object as a child of another with the normal aggregation, plus
using autoname. Ie the following two cases would be the same:

set nm [MyClass autoname MyClass]
MyClass ${ob}::$nm foo bar

and

$ob createAsChild MyClass foo bar

Thus making it much easier to use aggregation with automatically created
names. I'm not saying this is necessarily the best possible syntax
for that: maybe it would be better to do "MyClass newAsChild $ob foo bar"?
Anyway I only use autonaming myself for making instances of classes so
this would be quite useful. Of course, with XOTcl I'm allowed the
possibility of adding to the Object or Class objects myself which is
fabulous. Just that it might be useful as a core element of the language.

As a matter of interest, how many people here only use objects created
with autoname?

         -     ---------- = = ---------//--+
         |    /     Kristoffer Lawson      |  www.fishpool.fi|.com
         +-> |    setok at fishpool.com       |  - - --+------
             |-- Fishpool Creations Ltd - /         |
             +-------- = - - - = ---------      /~setok/





More information about the Xotcl mailing list