DEFSTRUCT allows () as slot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Low
|
Unassigned |
Bug Description
A colleque of mine changed a defclass to defstruct,
and forgot to remove the superclass list:
(defstruct quux ()
x)
SBCL happily compiles that one down, and creates a
a layout with an initial slot named NIL. However,
it should actually choke on it because that syntax
is not allowed as per DEFSTRUCT's CLHS entry.
I cannot reproduce it easily, but this actually
manifested itself by the following nasty PCL error.
There is no applicable method for the generic function
#<STANDARD-
SB-
when called with arguments
(#<SB-
[Condition of type SIMPLE-ERROR]
Restarts:
0: [RETRY] Retry calling the generic function.
1: [RETRY] Retry SLIME REPL evaluation request.
2: [*ABORT] Return to SLIME's top level.
3: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {BE9AC21}>)
Backtrace:
0: ((SB-PCL:
Locals:
1: (SB-PCL:
Locals:
2: (SB-PCL:
Locals:
3: (SB-PCL:
Locals:
4: (SB-PCL:
5: (SB-PCL:
Locals:
Changed in sbcl: | |
status: | Triaged → Fix Committed |
assignee: | Christophe Rhodes (csr21-cantab) → nobody |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
Stas Boukarev pointed out to me that NIL actually *is* allowed because a slot-name
is specified to be a symbol -- and NIL is a symbol of course.
This means that there's some bug somewhere of the line (when (...) ...) which
is not valid for a slot name being NIL.
Still, using NIL as a slot-name is sufficiently weird to warrant a style-warning, methinks. :-)