[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BOA constructor questions
- To: LOOSEMORE@UTAH-20.ARPA, common-lisp@SU-AI.ARPA
- Subject: BOA constructor questions
- From: Guy Steele <gls@THINK-AQUINAS.ARPA>
- Date: Thu, 26 Dec 85 16:09 EST
- Cc: gls@THINK-AQUINAS.ARPA
- In-reply-to: <12170260722.11.LOOSEMORE@UTAH-20.ARPA>
Date: Thu 26 Dec 85 13:38:50-MST
From: SANDRA <LOOSEMORE@UTAH-20.ARPA>
It is not clear from the discussion of BOA constructors in the manual what
is supposed to happen if you don't mention all the slot names in the arglist,
or even that it's legal to omit slots from the arglist. Presumably, the
omitted slots should be initialized to whatever default value was given in
the body of the defstruct; if this is the case, the manual should say so.
Perhaps a better example would help.
Also, it says that "the keywords &optional, &rest, and &aux are recognized
in the argument list". Is there a reason why &key is not permitted? Or
is this an oversight?
I don't see any technical reason why &KEY should not be permitted, with
semantics analogous to those for &OPTIONAL. Then the standard
constructor function can be explained as a special case the more general
constructor feature that happens to take an argument for every slot and
takes them all as &KEY arguments.
But this prompts in me another question: does
(defstruct (foo (:constructor build-foo (&optional baz &aux baz)))
(make-foo) initializes BAZ to 5
(make-foo :baz 43) initializes BAZ to 43
(build-foo 91) initializes BAZ to 91
(build-foo) *does not initialize* BAZ ?
If not, how else can I say it? (Never mind why I would want to.)