chiark / gitweb /
src/c-types-*.lisp: New type for functions which take keyword arguments.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 Jan 2016 13:51:04 +0000 (13:51 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 14:09:03 +0000 (15:09 +0100)
commitced609b8c5cc865f25cf5cce91a3d7dc9c85bdee
tree628723e82336c42180f651d83def9c74888f59a7
parentf450a3f29645da8e88213d865b9796567a381b9e
src/c-types-*.lisp: New type for functions which take keyword arguments.

This commit introduces a new `c-keyword-function-type', including
printing and parsing the things, and some utilities for working with
keyword argument lists (most notably merging them while providing useful
diagnostics about type mismatches).  This involves enhancing the
`argument' type to include an optional default value.

The surface syntax uses a `?' to separate the preceding mandatory
positional arguments from the following optional keyword arguments.  I'm
not completely thrilled by this choice, but I can't see many better
options.  The corresponding use of a `:keys' marker in the S-expression
syntax is also somewhat ugly (especially the way that `make-function-
type' acts on it), but better choices seemed thin on the ground.

An earlier experiment introduced a `keyword-argument' subclass, rather
than enhancing the existing `argument' structure, but it made many
things (e.g., commentifying argument lists) unnecessarily painful for
little benefit -- especially when I realised that it's important to
distinguish an ordinary function from one which notionally accepts
keyword arguments but doesn't actually define any (yet).
doc/SYMBOLS
doc/clang.tex
src/c-types-impl.lisp
src/c-types-parse.lisp
src/c-types-proto.lisp