View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] children order

From: Gustaf Neumann <neumann_at_wu.ac.at>
Date: Wed, 12 Jan 2011 14:39:47 +0100

Dear Krzysztof,

You might consider the OrderedComposite class from OpenACS:

http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/xotcl-core/tcl/20-Ordered-Composite-procs.tcl?r=HEAD

It preserves the original definition order (via method children)
and it supports optionally sorting. The OrderedComposite has
as well a "contains" method.

-gustaf neumann

Am 12.01.11 14:00, schrieb Krzysztof Frukacz:
> Hello,
>
> I would like to use the children mechanism for my classes. When I
> create a class (lets call it B) I use -contains {...} and list other
> objects. But in init proc of B I also use this: eval C new -childof
> [self].
> I am interested in the order that children are listed. I need it to be
> fixed. I noticed that first goes the child from init of class B, then
> the ones that I add using -contains (outside the init proc).
>
> Is this order fixed? (first children created in superclesses, then
> ones from cunstructor, then ones from -contains). Also: is the order
> used in -contains fixed? Will I always get children in the same order
> that I added them?
>
> Best Regards,
-- 
Univ.Prof. Dr. Gustaf Neumann
Institute of Information Systems and New Media
WU Vienna
Augasse 2-6, A-1090 Vienna, AUSTRIA