[plt-scheme] A puzzle for those people doing class.ss stuff

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Mon Nov 20 19:58:57 EST 2006

>> That's the unexpected behavior.  The fix is to pull super-new to after 
>> the definition:
>>      (define (my-mixin super%)
>>        (class super%
>>          (override set-x)
>>          (define x #f)
>>          (super-new)
>>          ...))
>> But this is subtle stuff.  In particular, one reason reason this is odd is
>> because this conflicts with the standard Java way of implementing class
>> initializers --- in Java, the call to the super's initializer must come
>> first.  Whereas in my code, if I do that, it screws things up.
> That's not the whole story: in our class system you get to decide the 
> relative ordering of the field initializers and the super call. you 
> don't get to make that decision in Java.

I wanted to bring it up because I didn't fully recognize the implications 
of when the super initializer fires off.

It means I have a little more work ahead of me: I must update:


and add my puzzle code in there somewhere to highlight that difference, 
because it is a crucial detail that I sorta glossed over.  Hopefully, no 
one else will get caught the way I did.  *grin*

Posted on the users mailing list.