chiark / gitweb /
New feature: messages with keyword arguments!
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:03 +0000 (15:09 +0100)
commit4307347660f48628e307f299eb4fac58ba35fd1a
tree9fbdf31571e34a7f59812d2dc953d34075254246
parent9e91c8e7b5fcdeb6389ac7ccbcd9c77348c4493a
New feature: messages with keyword arguments!

Let's start with the new functionality.

You can define messages which are meant to be given keyword arguments,
and methods which retrieve and (presumably) act on those keywords.  The
behaviour is as in Common Lisp: the acceptable keywords for a message
sent to an object are precisely those keywords acceptable to any
applicable method, and those listed in the message definition itself.

The Sod translator takes care of picking keyword argument lists apart
and passing actual arguments to the direct methods; arguments can have
default values (and each direct method can have different defaults),
and/or find out whether a keyword was actually provided.  The only picky
rule is that if two methods (or a method and the message itself) each
define an argument with the same keyword, then those arguments must also
have the same type.

The new code -- and there's quite a lot of it -- mostly concerns itself
with coping with messages and methods which accept keyword arguments,
and generating the proper functions and instructions for gathering them
and passing them about.  This is rather annoying and fiddly.

In particular, it seems as if I ought to be able to have factored the
existing machinery much better than I actually did if only I were more
clever, so that this new stuff could slot in neatly; instead, it looks
as if I just turned the program upside-down and shook hard, which is
pretty accurate really.
13 files changed:
doc/SYMBOLS
doc/concepts.tex
doc/layout.tex
doc/structures.tex
doc/syntax.tex
lib/sod-structs.3
src/class-make-impl.lisp
src/class-output.lisp
src/codegen-proto.lisp
src/method-impl.lisp
src/method-proto.lisp
src/module-parse.lisp
src/sod-module.5