swarm-support
[Top][All Lists]
Advanced

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

Seems like there ought to be a compile-time warning for this mistake


From: Paul Johnson
Subject: Seems like there ought to be a compile-time warning for this mistake
Date: Wed, 5 Aug 1998 12:14:59 -0500 (CDT)

I wrote up a "reapAgents" method in the style of Swarm SugarScape.  The
method in model swarm would cycle through the agent list, ask each one
if it was ready to die, and if so, it added them to reaperQueue and then
cycled through reaperQueue, removing the agents in there.

But nothing happened.  No errors, but nobody died.

Then I realized that I had not initialized the reaperQueue with
 reaperQueue=[List create: [self getZone]];
in modelSwarm.  That make it work.

I've made this mistake before, and it is difficult to debug because it
does not cause a seg fault and does not cause a compiler warning.

Don't you think it ought to?

Is this part of the price we pay for Objective-C's runtime binding?
I think C++ wouldn't allow this, from my limited experience.

Paul E. Johnson                      address@hidden
Dept. of Political Science           http://lark.cc.ukans.edu/~pauljohn
University of Kansas                 Office: (913) 864-9086
Lawrence, Kansas 66045               FAX: (913) 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.
                  ==================================


reply via email to

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