unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andrew Erlanger <andrew.erlanger@gmail.com>
To: guile-user@gnu.org
Subject: Problem merging generics across modules
Date: Thu, 12 Oct 2017 20:01:40 -0400	[thread overview]
Message-ID: <8760bjncez.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me> (raw)

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	other threads:[~2017-10-13  0:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  0:01 Andrew Erlanger [this message]
2017-10-13  0:03 ` Problem merging generics across modules Andrew Erlanger
2017-10-13 14:12 ` David Pirotte
2017-10-13 15:14   ` David Pirotte
2017-10-13 14:35 ` David Pirotte
     [not found]   ` <874lqxbgnf.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me>
2017-10-17 23:23     ` David Pirotte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760bjncez.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me \
    --to=andrew.erlanger@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).