No registered users in community xowiki
in last 10 minutes
in last 10 minutes
[Xotcl] Re: [Xotcl] Re: [Xotcl] Re: aggregate objects with autoname
From: Uwe Zdun <uwe.zdun_at_uni-essen.de>
Date: Wed, 30 May 2001 14:43:41 +0200
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
Date: Wed, 30 May 2001 14:43:41 +0200
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
-- Uwe Zdun Specification of Software Systems, University of Essen Phone: +49 201 81 00 332, Fax: +49 201 81 00 398 zdun_at_{xotcl,computer,acm}.org, uwe.zdun_at_uni-essen.de