sasagawa888 / eisl

ISLisp interpreter/compiler
Other
288 stars 24 forks source link

Parent method isn't called. #328

Closed mkamotsu closed 3 weeks ago

mkamotsu commented 3 weeks ago

If superclass method is defined, it have to be called for subclass instance.

(defclass <parent> () ())

(defclass <child> (<parent>) ())

(defgeneric print-self (obj))

(defmethod print-self ((obj <parent>))
  (format (standard-output) "PARENT:~S~%" (class-of obj)))

(print-self (create (class <parent>)))
;; => PARENT:<class <PARENT>>

(print-self (create (class <child>)))
;; => Expected PARENT:<class <CHILD>>, Not exit matched method at PRINT-SELF (<instance>)

(defmethod print-self ((obj <object>))
  (format (standard-output) "OBJECT:~S~%" (class-of obj)))

(print-self (create (class <parent>)))
;; => PARENT:<class <PARENT>>
(print-self (create (class <child>)))
;; => Expected PARENT:<class <CHILD>>, but OBJECT:<class <CHILD>>.
sasagawa888 commented 3 weeks ago

Thank you for the report. I'll review it thoroughly.

sasagawa888 commented 3 weeks ago

I am investigating it. The method sorting may not be working properly.

sasagawa888 commented 3 weeks ago

Fixed. Thank you.