chiark / gitweb /
Replace the `init' class-slot function with an `init' message.
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)
commita142609c5dc2a7c3df02497235881beaf47088bf
tree97505e0ac2f6fa254488e84166873a33fe20c5eb
parent54fa3df9560fe739b5fe20ca561749092cef0fd5
Replace the `init' class-slot function with an `init' message.

The `SodObject' class now defines an `init' message.  This message takes
keywords, which can be collected by methods and used to set up objects
in interesting ways.

The `init' message's default behaviour (unless overridden by a primary
or around method) is to initialize the instance's slots using the most
specific applicable initializers, just as the old `init' function used
to do.

Obviously, one can send an `init' message to an instance before it's
been imprinted, so that has to be done as a separate step now.  The
`SOD_DECL' macro has been adjusted to cope.  It also takes an additional
argument containing keyword arguments to be passed with the `init'
message (which constitutes an additional compatibility break).

The library has grown a new pair of functions `sod_init' and `sod_initv'
which wrap up the initialization protocol, and a macro `SOD_INIT' which
improves type safety a little.

(Some of the new code in `src/builtin.lisp' is a little odd.  This is
intended to accommodate future changes better.)
12 files changed:
doc/SYMBOLS
doc/concepts.tex
doc/runtime.tex
doc/structures.tex
lib/sod-structs.3
lib/sod.3
lib/sod.c
lib/sod.h
src/builtin.lisp
src/sod.asd.in
test/chimaera.sod
test/test.sod