DEFSTRUCT-CONSTRUCTOR-KEY-MIXTUREDEFSTRUCT constructor functions can be either the default constructor function, with *only* keyword arguments, or it can be a so-called "By Order of Arguments" constructor function with explicitly *no* keyword arguments. Other functions in Common Lisp allow a free mix of required, optional, and keyword arguments.
With the current restriction, it is necessary to hand code a function that will accept optional and keyword arguments and parse the supplied-p variables explicitly. Even so, it is not obvious to the casual programmer how to provide the same semantics as defstruct does with respect to default values and the defstruct init-forms.
KEY keyword arguments in constructor forms of DEFSTRUCTs and the &ALLOW-OTHER-KEYS token in addition to the &OPTIONAL, &REST and &AUX arguments already allowed. Keyword arguments default in a manner similar to that of &OPTIONAL arguments: if no default is supplied in the lambda-list then the slot initform is used; otherwise the slot is not initialized -- its initial value is undefined.
If keyword arguments of the form ((key var) [default [svar]]) are specified, the "slot name" is matched with VAR (and not KEY).
Additional arguments that do not correspond to slot names but are merely present to supply values used in subsequent initialization computations are allowed.
(defstruct (foo (:constructor CREATE-FOO (a &optional b (c 'sea) &key (d 2) &aux e (f 'eff)))) (a 1) (b 2) (c 3) (d 4) (e 5) (f 6))
(create-foo 10) => #S(foo a 10 b 2 c sea d 2 e nil f eff) (create-foo 10 'bee 'see :d 'dee) => #S(foo a 10 b bee c see d dee e nil f eff)
In the definition: (defstruct (frob (:constructor create-frob (a &key (b 3 have-b) (c-token 'c) (c (list c-token (if have-b 7 2)))))) a b c)
the c-token argument is used merely to supply a value used in the initialization of the c slot. The "supplied-p" arguments of keyword arguments might be of this form.
KEY arguments or arguments that are not slot names. The latest version of IIM Common Lisp allows &KEY arguments in this manner. Envos Medley (Xerox Common Lisp) implements the proposal.Version 2 of this proposal was on the January 1989 ballot.