swarm-support
[Top][All Lists]
Advanced

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

Re: More Swarm Beginner mistakes/questions


From: Rob Kewley
Subject: Re: More Swarm Beginner mistakes/questions
Date: Mon, 01 Dec 1997 07:57:08 -0500

Below are some comments and additions.  I have had similar experiences.

Paul Johnson wrote:
> 
> As I make these mistakes and learn from them, I'm going to
> ask if I've learned the right lessons and then other
> users might not blunder so badly.
> 
> Lesson 1.  Lists swallow objects and erase them.
> I was surprised that an object, called "current", turned up
> empty after I added this code:
> 
>    policyList = [List create: [self getZone]];
>      [policyList addLast: current];
> 
> I don't think the documentation makes it crystal clear that when
> you add an object to a list, it disappears from view  and won't
> answer messages anymore. Right?  

I have never seen this phenomenon.  I add objects to lists all the time
and am still able to refer to them in other places in the program. 
Lists certainly don't swallow them up.

> Lesson 2.  There are some funky problems that can happen if you choose
> swarm-official-names for things!...Is it generally known that you
> can't have two methods of the same name if they have differnt return types?

I learned the same lesson myself the hard way.  Perhaps it should be (or
maybe it already is) in the documentation somewhere.


> Lesson 4. The lack of a matrix algebra/vector passing ability seems to be a
> problem for me.  If the ideal array were a ten dimensional thing, it would get
> really inconvenient to individually refer to coordinates.  I've gotten around
> some problems by passing in an object that contains such an array.  That
> works, until one object has to tell the other what its array is. The only
> way I can figure to pass them out is to write one method for each dimension 
> and
> give them one floating point number at a time. (Hence a method getPolX has to 
> be
> written that has "return ideal[0]" and a method getPolY has a "return 
> ideal[1]"
> and then the object that receives those messages converts them back into an
> array with newarray[0]=[thatobject getX] and newarray[1]=[thatobject getY].
> 

You could get your desired result by having your matrix object return a
pointer to a simple C array containing the appropriate values.  I think
at the core of your question is the lack of standardized collection
objects to hold anything other than other objects (or integers cast to
id).  The addition of List, array, map etc objects for double values
would be a tremendous help to me in particular.  I currently implement
these in C.  Perhaps someone knows of a good swarm compatible objective
C library out there that already contains these objects.

Rob Kewley

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