[racket] Racket/class, inherit-field all

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Tue Apr 1 11:06:46 EDT 2014

On 2014-04-01 13:43:55 +0400, Roman Klochkov wrote:
>    Is there a way to inherit all fields ?
>
>    For example
>
>    (define a (class object% (super-new) (field f1 f2 f3)))
>
>    (define b (class a (super-new) (field f4 f5 f6)))
>
>    (define c (class b (super-new) (inherit-field f1 f2 f3 f4 f5 f6)))
>
>    How to avoid manual enumeration of all f1 ... f6?

I don't think there is, because you don't always know what what fields
your superclass will have. The `inherit-field` form gives you meaningful
errors if your superclass turns out not to have the field to inherit,
but it's not clear what to do for "all fields".

Cheers,
Asumu

Posted on the users mailing list.