swarm-support
[Top][All Lists]
Advanced

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

Re: ordering events in a swarm ....


From: Marcus G. Daniels
Subject: Re: ordering events in a swarm ....
Date: Wed, 16 Jun 1999 11:46:27 -0600 (MDT)

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

WS> Are you saying that one should do something like:
WS> [schedule at: t createActionTo: [someObject ensureTarget] message:
WS> M(anAction)];

May we step back and ignore at:createActionTo:message: and other Swarm
details for a moment?

Objective C is a dynamically typed language.  Many of the objects that
people use from Swarm or agents they add in their simulation are
declared using a generic `id' type.  That means the compiler doesn't
have enough information to know whether or not a given method makes
sense to send to such an object or for that matter be able to do
anything clever like auto-instantiation of the right kind of class,
etc.

Although dynamically typed languages have the disadvantage that it can
be hard or impossible to a prori prove that a given method will work
for a given target variable (which would increase the `correctness' of
the program), they have the advantage of letting the
programmer/modeler delay global decisions.  In some sense, bottom-up
modeling is all about delaying global decisions and making due without
full knowledge of a system.  I mean, why else simulate?

When programming using a dynamically typed language, it's better to
think in terms of values and behaviors, NOT type declarations that the
compiler propagates and enforces.  The idea is to get the behaviors
and interactions you want, and then step back and look at what are the
inherent commonalities in object structure and behavior.  With that
information, you can start to freeze certain things using variable
typing, and method protocols.  One reason that Swarm uses Objective C
instead of C++ is to not force modelers into making many (probably
inappropriate) global decisions.  Incidentally, Java is oriented more
toward static typing, and because of this we have had to add
artificial classes like `Selector' and various convenience layers to
reduce gratuitous type casting.

Anyway, as a rule of thumb, whenever you have a named
generically-typed (`id') variable in Objective C but it isn't obvious where
it came from (as opposed to what it Ought to be able to do given the
type alone), there is the potential for a bug.  Out of sight, out of mind.

WS> I may be missing something, but I do not see how this guarantees
WS> all previous schedules remain in place,while adding a new one.

That's a default property of a Schedule.  Future events remain
in place and past events are dropped if the AutoDrop feature is set.

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