swarm-support
[Top][All Lists]
Advanced

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

Re: Help on compiler messages


From: Benedikt Stefansson
Subject: Re: Help on compiler messages
Date: Mon, 01 Feb 1999 17:57:59 -0800

Fabio,

> The point is that during compiling, the compiler complains that...
>
> Bug.m: in function '-[bug step]'
> Bug.m:75: warning: cannot find method
> Bug.m:75: warning: return type for 'kill:' defaults to id
>

> Why this warning and what should I do to make it disappear(should I
> import "ModelSwarm.h" in "Bug.h" an declare myModel as a variable of
> Type ModelSwarm instead of generic type id)?

First of all, as you indicated the warning is benign, since you know
that at runtime the ModelSwarm instance will be found and the -kill
method executed correctly.

In general your suggested fix is correct, that is you could import
ModelSwarm.h in Bug.h and declare ModelSwarm * myModel. In practice
however this might give you additional problems, because now Bug.h is
imported in ModelSwarm.h and vice versa. This will make the compiler
profoundly unhappy and cause it to refuse to compile (in addition the
error message is usually completely uniformative).

I have yet to find a general solution to the problem, it is often more
work than it is worth, i.e. you have to use protocols and dynamically
type the receiving object (myModel). This fix wouldn't work in this
case.

On another note - as mentioned repeatedly on the list - remember that
if  want to kill agents, you should implement a "reaperQueue" (list),and
remove them cleanly from all lists at the end of a timestep when all
updating of model and output is done. The logic is: accumulate bugs on
reaperQueue, at appropriate time move down the queue and remove each bug
from lists, then remove it from the queue and drop.

The point is, don't kill (drop) an object that is being referred to by
one or more lists or agents, and may be called on to update graphs, the
raster etc. Paul Johnson pointed out that the SSS (Sugarscape) demo
program has a reaperQueue example.

-Benedikt


Benedikt Stefansson                 address@hidden
Department of Economics, UCLA       Fax. (310) 825-9528
Los Angeles, CA 90095-1477          Tel. (310) 825-1777



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