[Q] I find this code in 3.9 image and wish know if is correct

Boris Gaertner Boris.Gaertner at gmx.net
Mon Aug 15 16:17:12 UTC 2005


 "Lic. Edgar J. De Cleene" <edgardec2001 at yahoo.com.ar> wrote:

Subject: [Q] I find this code in 3.9 image and wish know if is correct


<snip>

> done  is undefined before evaluation.
> 
> I try to feed SqueakLight with methods what have 2005 timestamp,but
> complaints for this one.
> 
> Edgar 
> 
> 
I think this code is correct. It was discussed in October 2004
under
the subject title "timing out a method call". The code is
an adaptation of very old code written by Allan Schiffman.

 As to the complaint:
The first statement of the second block assigns an value to the
instance variable done. This happens before the watchdog block
is resumed. The   
   done ifFalse: 
in the watchdog block will therefore not fail.
The problem is that the compiler cannot verify this fact, it does
a simpler code analysis that can fail when block come into play.

You can remove the compiler complaints by moving the

  done := false.

before the assignment to the variable  watchdog.
(Early initialization is never wrong and with early initialization
the compiler will be happy.)

Greetings,
Boris




More information about the Squeak-dev mailing list