On Monday 28 May 2001 19:02, Kristoffer Lawson wrote:
On Mon, 28 May 2001, Gustaf Neumann wrote:
Dear Kristoffer,
are you aware of the predefined methods "new" and "newChild" (the first one simplifies only the call to autoname, while the second one creates a new autonamed object as an aggregated child object). These convenience methods are defined in the langRef. the definition of newChild is below...
Yes, I'm aware of them, but they do not do what I mean. I want to create an object as a child of an already existing object which != [self]. "new" creates a new object, but not as an aggregate of another object, "newChild" creates a new object as the child of the calling object. These are very convenient and I use both a lot, but the method I proposed is for easily aggregating a new object to anything.
We would propose a new:
Class instproc newChildOf {obj args} { ::set name [[self] autoname -instance [namespace tail [self]]] ::eval [self] create ${obj}::$name $args }
which would be almost identical to newChild, but allows for specifying an object name...
--UZ