swarm-support
[Top][All Lists]
Advanced

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

Re: pass an ivar name through as an argument to a method?


From: Fernando Diaz
Subject: Re: pass an ivar name through as an argument to a method?
Date: Tue, 7 Mar 2000 13:05:25 -0500 (EST)

passing ivar references around is fragile.  if you want this type of
dynamic assignment, i would set up some sort of keyed collection in the
Agent which contains its possible contexts ("home","work").  that way you
can toss in new contexts on the fly ("mall").

but if you do not see contexts beyond home/work, just stick with the
originals.  it's just better design.

F

On Tue, 7 Mar 2000, Paul Johnson wrote:

> Agent has ivars that refer to grids, like "home" and "work".
> 
> instead of saying
> 
> -setHomeX: (int) x Y: (int) y;
> and
> -setWorkX: (int) x Y: (int) y;
> 
> I want a single method that takes the ivar as an argument.  I want
> something like:
> 
> -setPositionGrid:  (char *) worldName X: (int) x Y: (int) y; 
> 
> But need a hint on how to pass in the ivar name and use it.  OR point me
> at an example.
> 
> -- 
> 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.
> 
> 



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