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: Benedikt Stefansson
Subject: Re: pass an ivar name through as an argument to a method?
Date: Tue, 07 Mar 2000 21:45:13 -0700

Fernando Diaz wrote:

> On Tue, 7 Mar 2000, Benedikt Stefansson wrote:
>
> > Fernando Diaz wrote:
> >
> > > 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").
> >
> > This is exactly what ProbeMaps are for.
>
> Is this true?  Can you add new elements to a probe map on the fly given
> they are not in the class interface?

No, although I think there is nothing preventing you from creating a probe map
with probes from different classes, they have to exist in *some* class at
compile time.

> I was just saying that, since "home" and "work" are conceptually similar
> (both refer to grids), a key collection would let you have a dynamic set
> of keyed grids.  I do not understand how this could be done using
> ProbeMaps unless you enumerate a set of possible grid references as a
> whole mess of ivars.

You are probably right. The names of ivars involved in the 'setting' have to
come from somewhere, so the difference between coding specific accessor methods
for ivars and creating customized probe maps is probably marginal.

However the probe maps are one of the neater ideas in Swarm (and one can now do
much of the same in kosher Java with the Reflection API) - so I wanted to remind
people to look into putting them to good use.

Benedikt


--
Benedikt Stefansson      | address@hidden
CASA, Inc.               | Ph : (505) 988-8807 x101
Santa Fe, NM 87501       | Fax: (505) 988-3440




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