Kalle Olavi Niemitalo
2/3/2016 10:54:00 PM
Marco Antoniotti <marcoxa@gmail.com> writes:
> On Wednesday, February 3, 2016 at 6:08:08 AM UTC-8, Madhu wrote:
>> (defclass foo-standard-class (standard-class) ())
>> (defclass foo-class () () (:metaclass foo-standard-class))
In SBCL 1.0.57.0.debian, that signals an error unless I also do
(defmethod sb-mop:validate-superclass ((class foo-standard-class)
(superclass standard-class))
t)
>> (setf (find-class 'foo) (find-class 'foo-class))
>> (make-instance 'foo)
>
> Yes it works, but you are now loosing the status of FOO as a STRUCTURE-CLASS.
In this version of SBCL, the reader signals an error for "#S(FOO)":
FOO is not a defined structure type.
If I did (defparameter *real-foo* (make-instance 'foo)) before
defining a method on MAKE-INSTANCE, then after SETF FIND-CLASS,
(typep (make-foo) 'foo) is NIL and (typep *real-foo* 'foo) is T.
I don't think the latter is required. 4.3.7 says "The proper name
of every class is a valid type specifier", but the symbol FOO is
no longer the proper name of any class. OTOH, I don't know
whether anything forbids treating it as a type specifier still.