swarm-support
[Top][All Lists]
Advanced

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

Re: Using collections


From: glen e. p. ropella
Subject: Re: Using collections
Date: Thu, 23 Jan 1997 07:54:06 -0700

Ken,

I guess, in a way, the behaviour of index can be defended
philosophically but not pragmatically.  (And I trust Roger
will correct me if I say anything wrong. [grin])  Collections
are, literally, collections of objects.  They're not even 
as well-defined (in a mathematical sense) or well-specified
as "sets."  What they're intended to do is provide the most
general kind of gatherings of objects as is reasonable.  Hence,
predefining the behaviour of a List Index when it reaches the
end of a list is probably not a good idea.

This is analogous to using an array in some other language (even one
that does bounds checking at compile time).  If the language, itself,
understood that

   x = array[indx];

to mean "x = array[mod(indx,SIZE)]", where SIZE is the size of the
array, then array overruns would be less frequent and all arrays would
be cyclic groups.  Now, if this were well understood by all
programmers, then there's probably no problem.  But, it would still
lead to more obscure and harder to detect errors in the program.

So, on the one hand, making all lists cyclic groups would lead to
fewer seg faults; but, on the other hand, not assuming the special
functionality of a certain kind of list leaves things open-ended
for more flexibility.

Another point to be made is that "collections" were designed from the
perspective that the indices are the controllers of access to the
collections.  I.e. if your index tells you that you're done, then
you're done.  What you're trying to do is control access to the list
by some other means.  Even though your index has told you that you're
at the end of the list, the agent may continue to call the
"getNextGoal" function.

Don't misunderstand me.... I'm not trying to be pedantic or tell you
that you're using lists incorrectly or anything like that.  I'm
just trying to present a justification for the way lists and indices
behave.  One of Swarm's problems is that too little of the design
issues and desicions have been justified in a public way.  Like,
for instance, "What's with these 'schedule' thingies, anyway?  I 
can do all this without this weirdo 'activateIn' stuff."  (This is
a very paraphrased paraphrase of what we imagine some new users
might say. [grin])  We're trying to address this type of question
with some documentation and well-documented demo apps.

So, there you have my morning proselytization on Collections. [grin]
Here endeth the lesson.

With feined authority,
glen 


reply via email to

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