[plt-scheme] Re: Object system

From: Guenther Schmidt (gue.schmidt at web.de)
Date: Sun Dec 21 10:21:28 EST 2003

Dear Matthew,

that's good news in some respect, at least I must have understood something right, but bad news in another.

I would need to add some code in the redifinition *after* the call to the "super method", something like

(sup x y)
(send x get-value)

But that won't work.

Best regards

Guenther

Matthew Flatt wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> At Sun, 21 Dec 2003 14:12:12 +0000, Guenther Schmidt wrote:
> 
>>I'd like to create a new class derived from one of MrEDs class,
>>overwrite the, for instance, on-subwindow-char method, but still make
>>a call within the new method to the super method.
>>
>>What is the proper procedure to do this, can it be done?
>>
>>As an example:
>>
>>(define my-text-field%
>> (class text-field%
>>   (rename (sup on-subwindow-char))
>>   (define/override-final on-subwindow-char
>>     (lambda (x y)
>>       (display y)
>>       (newline)
>>       (sup x y)))
>>   (super-instantiate ())))
>>
>>This only works to a certain extent, I have to call "sub" at the very end 
>>otherwise it won't work.
> 
> 
> This is exactly the intended way to override a method and chain to the
> overidden implementation.
> 
> Matthew
> 
> 



Posted on the users mailing list.