guile-user
[Top][All Lists]
Advanced

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

Problem merging generics across modules


From: Andrew Erlanger
Subject: Problem merging generics across modules
Date: Thu, 12 Oct 2017 20:01:40 -0400

Hello, Schemers,

I am trying to extend the definition of a few primitives,
including equal?, in a project of mine. Let's say that a.scm contains:

(define-module (project a)
  #:use-module (oop goops)  
  #:export (equal?)

...

(define-method (equal? (c1 <color>) (c2 <color>))
   (same-rgb? c1 c2))

Now I go to the REPL, and this is what I see:

scheme@(guile-user)> equal?
WARNING: (guile-user): `equal?' imported from both (ice-9 r5rs) and (capital 
base)
$2 = #<<generic> equal? (2)>
scheme@(guile-user)> (equal? 2 3)
ERROR: In procedure scm-error:
ERROR: No applicable method for #<<generic> equal? (2)> in call (equal? 2 3)

Now I'm aware of "#:duplicates (merge-generics)", but I don't understand
how to apply it in this case. I've tried replacing the module definition with:

(define-module (project a)
  #:use-module (oop goops)  
  #:use-module (ice-9 r5rs)
  #:duplicates (merge-generics)
  #:export (equal?)

but this doesn't seem to do anything.

Any advice? Thank you.

- Andrew



reply via email to

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