Parse DEFSTRUCT more strictly.
commitdb2cb147b15b0b9febc71a5094d8c4ee92a74cf9
authorDouglas Katzman <dougk@google.com>
Fri, 15 Aug 2014 01:08:35 +0000 (14 21:08 -0400)
committerDouglas Katzman <dougk@google.com>
Fri, 15 Aug 2014 01:20:36 +0000 (14 21:20 -0400)
tree60b738c796e0aff0dc1d67182fd10a8188060c3e
parent5f57f03a8838fdf3573808ad1df26154c858a9e3
Parse DEFSTRUCT more strictly.

Previously we disallowed repetition of :INCLUDE, but nothing else.
Now nothing is repeatable except :CONSTRUCTOR and :NAMED.

Also we accepted (DEFSTRUCT (FOO (:TYPE LIST) :PREDICATE) X) which isn't
right because the atomic form of :PREDICATE in the usual usage means that
a predicate is wanted, and the general remark in CLHS that option :<atom>
means the same as (:<atom>) applies, and (:predicate) is clearly defined
to mean that a predicate is requested with a default name of <NAME>-P.
This seemed incontrovertible, but I checked several other Lisps and found
that they allow that usage but do not define the predicate, exactly as SBCL.
Our excuse, so it seemed, was that TYPED-PREDICATE-DEFINITIONS had to guard
a defun with (AND PREDICATE-NAME (DD-NAMED DEFSTRUCT)) because we always
assigned a PREDICATE-NAME into the DD on creation, even if it would later
be set to NIL or changed. This was sloppy because it meant that macroexpansion
of a DEFSTRUCT would intern bogus symbols, and that an alternate-metaclass
struct falsely indicated in its DD that it had both a predicate and copier
when it has neither typically. There remains no reason for such slop.
src/code/defstruct.lisp
tests/defstruct.impure.lisp