#234 Null slot-location causes problems for non-standard meta-classes.

HEAD
closed
nobody
None
9
2014-09-23
2012-12-18
stassats
No

When a class with a custom metaclass inherits a slot with an accessor from a superclass of standard-class, and that accessor is called on an instance of the non-standard class, it tries to access slot-location table, which is NIL, and it fails.

(defpackage test
  (:use :c2cl))

(in-package :test)

(defclass meta-class (standard-class)
  ())

(defmethod validate-superclass
    ((class meta-class) (superclass standard-class))
  t)

(defclass x ()
  ((slot :initform nil
         :accessor slot)))

(defclass y (x)
  ()
  (:metaclass meta-class))

 ;;;

  (slot (make-instance 'y)) =>
  In function GETHASH, the value of the second argument is
    NIL
  which is not of the expected type HASH-TABLE

Discussion

  • I have changed the code for the optimized slot accessors. Please check and reopen if needed.

    Sincerely, I never contemplated that nonstandard metaclasses could inherit from standard ones -- I still find it awkward and prone to fail.

     
  • stassats
    stassats
    2012-12-18

    With this fix, ECL is now able to run commonqt (not an upstream version, though).

     


Anonymous


Cancel   Add attachments