Dmitry Bogatov <kact...@gnu.org> skribis: > (define-method (equal? x y) > ((@ (guile) equal?) x y))
This really shouldn’t be needed, and I would even expect it to lead to infinite recursion actually. > (define-method (equal? (this <object>) (other <object>)) > (let* ((class_ (class-of this)) > (slots (map car (class-slots class_)))) > (define (slot-values instance) > (map (cute slot-ref instance <>) slots)) > (if (eq? class_ (class-of other)) > (false-if-exception (equal? (slot-values this) (slot-values other))) > #f))) > > I do not know, why first one `equal?` is needed, but otherwise guile > complained, that no method is present to compare two lists. Hmm, simply doing the following works for me: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(oop goops) scheme@(guile-user)> (define-method (equal? (a <object>) (b <object>)) 42) scheme@(guile-user)> (equal? 1 2) $1 = #f scheme@(guile-user)> (equal? <class> <string>) $2 = 42 --8<---------------cut here---------------end--------------->8--- > Interesting enough, I created simple module, and behaves as it should. > Maybe you have some wild guess about class being defined not via macro? What do you mean by “simple module”? Thanks, Ludo’.