[DGD] Possible bug in DGD 1.1?
Stephen Schmidt
schmidsj at union.edu
Wed Jun 3 00:57:57 CEST 1998
I have found a case where, if I understand everything correctly,
DGD is not doing what the documentation implies it should be.
It's far more likely than I'm misunderstanding something. Any
helpful clarification would be gratefully received... :)
The problem, succinctly, is that I appear to be unable to make
a call_out to a static function. My auto object has the two
following functions (heavy snippage applied):
void set_heart_beat (int time) {
heart_beat_handle=call_out("do_heart_beat",time) ;
write ("HBH is "+heart_beat_handle+"\n") ;
}
static void do_heart_beat() {
get_object(ME)->catch_tell("foo") ;
err = catch(this_object()->heart_beat()) ;
heart_beat_handle = call_out("do_heart_beat",heart_beat_time) ;
}
The object in question has the following code, also snipped:
void create() {
set_heart_beat(5) ;
}
void heart_beat() {
write ("hello world!\n") ;
}
When I run this code I see the first write result, the first call_out
is made, but nothing else comes to my screen and no second call_out is
made. When I change the declaration of do_heart beat to remove "static":
void do_heart_beat() {
then it works fine. So I'm pretty sure that it's the static
declaration that stops it.
The DGD documentation sayeth:
NAME
call_out - call function with delay
DESCRIPTION
Call a function in the current object with a delay. The
function to be called must not be private.
But it appears from the above that it can't be static either.
Of course, I kind of need it to be static; it would be Bad if
another object could call into do_heart_beat and start, or change
the delay on, the first object's heartbeat.
Any ideas? What's wrong here?
Thanks in advance,
Stephen Schmidt
A general who husbands his reserve until the day following a battle
is commonly, and deservedly, beaten.
- Napoleon
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list