defclass allows invalid slot options
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
CL-USER> (defclass ttt () ((s :initargs (:s))))
#<STANDARD-CLASS COMMON-
Note the usage of :initargS instead of :initarg.
CL-USER> (make-instance 'ttt :s 0)
; Debugger entered on #<SB-PCL:
The ANSI standard states that "It is required that all implementations signal an error of type program-error if they observe a class option or slot option that is not implemented locally."
It seems that the slot options are not checked until a call to make-instance for standard-
1: ((:METHOD MAKE-INSTANCE (CLASS)) #<STANDARD-CLASS SB-MOP:
Locals:
CLASS = #<STANDARD-CLASS SB-MOP:
#<CONS {1007569867}>
-------
A proper list:
0: :CLASS
1: #<STANDARD-CLASS COMMON-
2: :NAME
3: S
4: :READERS
5: NIL
6: :WRITERS
7: NIL
8: :INITARGS
9: NIL
10: SB-PCL::SOURCE
11: #S(SB-C:
12: :READERS
13: (S)
14: :INITARGS
15: (:S)
I'll admit to being rather inexperienced with Common Lisp and CLOS. In fact it may be the only reason I noticed this. I mistakenly used :initargs instead of :initarg and it took me a while to figure out why I could not make a new instance.
Environment Info
----------------
$ sbcl --version
SBCL 2.0.6
$ uname -a
Darwin Waynes-
CL-USER> *FEATURES*
(:SLYNK :CL-JSON-
:CL-JSON-CLOS :CL-JSON :FLEXI-STREAMS :CHUNGA CHIPZ-SYSTEM:
:CL-PPCRE :SBCL-DEBUG-
:BORDEAUX-THREADS CFFI-FEATURES:
CFFI-FEATURES:UNIX CFFI-FEATURES:
:SPLIT-SEQUENCE ALEXANDRIA:
:ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-MACOSX :OS-UNIX
:NON-BASE-
:COMMON-LISP :DARWIN :IEEE-FLOATING-
:PACKAGE-
:SB-THREAD :SB-UNICODE :SBCL :UNIX)