[FIX] ClassVarsFix-petervr

Peter van Rooijen squeak at vanrooijen.com
Thu Oct 9 02:10:18 UTC 2003


Okay, so here is the fix for the class variable lookup bug. I don't know
exactly for which compiler version it is, but I made it against the 3.6
distribution.

I'm happy that I succeeded in sending it using the 'mail to list' option. I
got a walkback when trying to use Celeste, sorry I couldn't send that one in
;-).

I should make a comment about the fix:

I'm not too happy about what I had to do to make the fix. There are 3
changes:

1) One concerns the lookup logic itself. No problem with that one, just a
simple case of looking at inherited class variables before anything else.

2) The second was the #declare: method to "declare" a class variable. It
seems it was actually constructed to handle resuming from the "error:" of
defining a class variable. I find this rather counter-intuitive. The
mechanism is to pop up a debugger saying there is an error, that the name is
already defined, but if you know what the method does, it turns out you can
actually proceed. The installed code won't work after that, but you can
actually proceed.

Then the code itself, which was totally cryptic. Even though I basically
knew what the method was supposed to accomplish, it took me a lot of time to
figure out what was actually going on. I hope I figured it out correctly.
Please check that the new version indeed does the right thing. I tried to
make it as (self-) explanatory as I could.

3) The third one was the method that returns the classPool of a class. It
gives the impression of being a lazy init method that doesn't actually work
(because the created dictionary is not captured). I changed it to capture
the dictionary. This probably speeds up the system just a bit as well, as it
avoid endless creation and garbage collection of transient empty
dictionaries.

I don't know of a way to run regression tests against the changes I made, it
would be nice if those came with the image, so the author can at least
verify that before sending the fix in. Perhaps they are there, but I just
don't know where they are.

In any case, the fix did what I wanted it to do. My program loaded, ran
without a hitch, and passed all its tests. I hope it doesn't break something
else.

All in all, an interesting experience.

Cheers,

Peter van Rooijen
Amsterdam




More information about the Squeak-dev mailing list