swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: create: zone


From: Paul Johnson
Subject: Re: create: zone
Date: Tue, 18 May 1999 15:12:26 -0500

> 1.      [ whatever create: zone];
> 2.      [ whatever create: self ];
> 3.      [ whatever create: [self getZone]];
>

This might be confusing because there was a change in Swarm about one year
ago that affected the way this is done.  Some of the tutorial and example
programs still use format #3.   That worked, and still does work, but it is
not the best.   Now objects of Swarm type are themelseves zones, so when in
ModelSwarm.m one used to write createBegin: [self getZone] now you can write
createBegin: self.  Before, when a Swarm was not a zone (did not conform to
the zone protocol, we'd say?) then the [self getZone] was used to find out
what the zone was and grab it.  The current way is good because it opens up
the possibility that one can drop a whole Swarm object and get rid of
everything created in it.

If you create objects inside SwarmObjects, then you still have to use the
[self getZone] format, because SwarmObjects are not zones and won't know what
to do if you just say self.  So, in a Swarm Object that is created in the
ModelSwarm,  [self getZone] gets the Zone from the Model and uses it to
create something.
These objects created inside SwarmObjects are not automatically dropped when
you drop the SwarmObject iself, so you have to make sure you drop them
individually before you drop the object itself.  I think the right thing to
do for that is to put a -drop method in your class and put drop messages to
objects you allocated and then include [super drop] at the end of it.

--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700




                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]