chiark / gitweb /
src/builtin.lisp: Bind `me' around slot initializers, and define the order.
Previously, the `init' method kernel (and the `init' class-slot function
before that) initialized one chain at a time, then down the chains,
because this made for a convenient traversal of the class layout. But
it sucks for users.
Make this better. Bind `me' around slot initializers -- to the type of
the direct slot. This means that initializers can compute their values
based on other previously initialized slots, which is useful because
subclasses can override initializers for their superclasses.
The `me' pointer has the type of the class owning the direct slots being
initialized, which means that referring to substructure belonging to
classes other than the superclasses of the slot owner is hard, even if
the initializer can be sure (because it was defined on some subclass)
that those other classes are available. This is nonetheless the right
thing because (a) it means that the `me' pointer has a reliable type,
and (b) the slots belonging any other classes which might be of interest
won't have been initialized by this point.
Take the opportunity to clarify the documentation regarding slot
initialization generally.