swarm-support
[Top][All Lists]
Advanced

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

Re: Can a Swarm instance be treated like a SwarmObject instance?


From: Marcus G. Daniels
Subject: Re: Can a Swarm instance be treated like a SwarmObject instance?
Date: 23 Apr 1999 09:50:53 -0700

>>>>> "WS" == William S Shu <address@hidden> writes:

WS> Could you please indicate where I could read more about these
WS> PHASE and USING mechanisms?  I saw them somewhere, but have never
WS> really been able to trace them again.

An interface phase is a set of methods associated with some particular
mode of use of that interface.

In Swarm, we commonly implement things to have three phases:
a creating phase, a setting phase, and a using phase.

Creating phase:

The methods in the creating phase are the methods that are used
exclusively for describing and creating an object.  For example, 
+createBegin: and -createEnd.  Sometimes there are -setSoAndSo* methods
in creating phase that describe attributess of the object being created, but
have no other use once the object has been created. 

The main idea with creating phase is that -createEnd can look at the
attributes it has been provided, and select the most appropriate
implementation strategy.  Right now, the way that can be done is by
selecting a class to instantiate.  What we would like to have,
eventually, is the ability to assemble a class on the fly method by
method.¹  

Using phase:

The methods that end up getting used in a model are using phase methods.  
Roughly speaking, creating phase methods are the things a caterpillar
does, whereas using phase methods are the things a butterfly does.
Also, the caterpillar methods are withdrawn from the butterfly.

Setting phase:

Sometimes an object attribute has a default value that is convenient
to set at the time it is created, but then can be modified at any
time.  Methods of this kind go in the setting phase.  Setting phase methods
are essentially methods present in both creating and using phases.
Identifical behaviors that both the caterpillar and the butterfly share.

Right now, the way this stuff works is by splitting a tagged
implementation class into method groups, `phases'.  In the protocols
the phases are delimited by CREATING, SETTING, and USING, whereas in
the implementation they are delimited by PHASE(Creating),
PHASE(Setting), and PHASE(Using).² 

¹ As we evolve the multilanguage interface, I'd like to support
interpreted languages so that the methods themselves are mutable.
Actually, with Java Native Interface (JNI), classes can be built up
from byte code so in some sense once we have 2.0 released that feature
is covered.

² Some time, hopefully soon, these conventions (and the splitting
machinery) will be eliminated in favor of multiple @interfaces
associated with a single protocol.  In other words, instead of one
class named FooBar with PHASE(Creating,Setting,Using) tags, there will
be three classes: @interface FooBarState, @interface FooBar, and
@interfaceFooBarUsing.  One practical reason for doing this is to make
Swarm work with IDEs like Apple WebObjects, that don't use the GNU
libobjc runtime.  (The phase splitting machinery depends on features
found only in the GNU libobjc runtime.)

                  ==================================
   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]