[plt-scheme] class.ss positional initialization of inherited fields
At Fri, 1 Nov 2002 13:11:19 -0500, "Neil W. Van Dyke" wrote:
> Is there a way with PLT 200 "class.ss" to inherit initialization fields
> from a superclass, such that they can be used within methods, *and* have
> the inherited fields come first in the make-object positional
> initialization order?
I've just committed a change to `class' that allows separate internal
and external names for fields and init arguments (finally!).
So, now the order you want is possible with
(define a% (class* object% ()
(init-field x)
(super-instantiate ())))
(define b% (class* a% ()
(init x)
(init-field y z)
(inherit-field (orig-x x))
(define/public (xyz) (list orig-x y z))
(super-instantiate () [x x])))
Note that this technique requires repeating the init arguments in b%
that you want to be in front for the init-argument order, and then
passing on the arguments explicitly in `super-instantiate'. We don't
have anythong more automatic right now.
Matthew