chiark / gitweb /
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).