chiark / gitweb /
src/builtin.lisp: Bind `me' around slot initializers, and define the order.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 15 Dec 2015 19:15:23 +0000 (19:15 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 14:09:04 +0000 (15:09 +0100)
commit27ec3825bd945bcdae0dca8ab2b4475c4722b313
treeb9706f7bffdcbac359d0fa61dcd37fe2bcd7a4aa
parenta142609c5dc2a7c3df02497235881beaf47088bf
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.
doc/concepts.tex
doc/structures.tex
src/builtin.lisp