Commit ddb8a7db authored by  Hayley Patton's avatar Hayley Patton 🐢

Finalise the class before accessing the computed slot table, as we do with the normal slot table

parent 5029b323
......@@ -47,12 +47,13 @@ Providing the class option (:scripts script ...) will attach the initialisation
(netfarm-class-message-script class)
(eval script)))
;; The initialisation scripts of a class are the direct scripts of itself
;; and the scripts of its superscripts. This isn't very different to how
;; slots are inherited in CLOS.
;; and the scripts of its superscripts, with duplicates removed. This isn't
;; very different to how slots are inherited in CLOS.
(slot-value class 'scripts)
(append (netfarm-class-direct-scripts class)
(loop for class in (closer-mop:class-direct-superclasses class)
appending (netfarm-class-scripts class)))))
(remove-duplicates
(append (netfarm-class-direct-scripts class)
(loop for class in (closer-mop:class-direct-superclasses class)
appending (netfarm-class-scripts class))))))
(defmethod initialize-instance :after ((class netfarm-class) &key)
(force-script-data-evaluation class)
......@@ -65,10 +66,13 @@ Providing the class option (:scripts script ...) will attach the initialisation
(defmethod netfarm-class-slot-table :before ((class netfarm-class))
(unless (closer-mop:class-finalized-p class)
(closer-mop:finalize-inheritance class)))
(defmethod netfarm-class-computed-slot-table :before ((class netfarm-class))
(unless (closer-mop:class-finalized-p class)
(closer-mop:finalize-inheritance class)))
(defgeneric netfarm-class-name (class)
(:method ((class netfarm-class))
(bytes->base64 (hash-object (class->schema class)))))
(hash-object* (class->schema class))))
(defclass netfarm-slot (closer-mop:standard-direct-slot-definition)
((computed :initarg :computed :initform nil)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment