guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Goops generic-functions and srfi-64 tests


From: Ludovic Courtès
Subject: Re: Goops generic-functions and srfi-64 tests
Date: Sat, 22 Nov 2014 22:24:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

address@hidden skribis:

> Recently I noticed, that srfi-64 `assert-equal` macro do not use
> `equal?` that was redefinded via `define-method` in scope of invocation
> of `assert-equal`. It means, that
>
>       (define e1 (make <foo> #:x 2))
>         (define e2 (make <foo> #:x 2))
>         (equal? e1 e2) ;; Overloaded to return #t
>       (assert-equal (make <foo> #:x 2) (make <foo> #:x 2)) ;; fails
>
> Why it happens, is clear. Since scheme macros are hygienic, equal? in
> expansion of `assert-equal` is sealed to refer to (@@ (srfi srfi-64)
> equal?).

No, that’s normally not a problem: (define-method (equal? ...) ...)
should turn the core ‘equal?’ primitive into a generic function, and
things would work well because (@@ (srfi srfi-64) equal?) is the same as
(@ (guile) equal?).

How exactly did you define ‘equal?’ methods?

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]