unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: David Pirotte <david@altosw.be>
To: Andrew Erlanger <andrew.erlanger@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: Problem merging generics across modules
Date: Fri, 13 Oct 2017 11:35:09 -0300	[thread overview]
Message-ID: <20171013113509.09cf6049@capac> (raw)
In-Reply-To: <8760bjncez.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me>

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

Hi again,

> (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.

Because that was not the source of your problem, see my previous email.

Although in theory merge-generics is only needed when you import more then one module
that define the 'same' generic function, I personally recommend you to add the option
in any modules that use goops, unless you really know what you are doing:

	this is because as time goes, you may rearrange your modules, import
	others ... and forget that more then one defined a generic function, and ...
	bang! (and these bugs are among the most diffcult to track down and debug

Note that you probably want more then just 'merge-generics, and prefer to extend the
default set:

	scheme@(guile-user)> (default-duplicate-binding-handler)
	$10 = (replace warn-override-core warn last)

So this gives you:

  #:duplicates (merge-generics
		replace
		warn-override-core
		warn
		last)

Also note that you have to set this in the repl as well, if you import more then one
module defining the 'same' generics ...:

	(default-duplicate-binding-handler
	   '(merge-generics replace warn-override-core warn last))
	$11 = (#<<generic> merge-generics (3)> #<procedure replace (module name int1 val…> …)
	scheme@(guile-user)> (default-duplicate-binding-handler)
	$12 = (merge-generics replace warn-override-core warn last)

David

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2017-10-13 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  0:01 Problem merging generics across modules Andrew Erlanger
2017-10-13  0:03 ` Andrew Erlanger
2017-10-13 14:12 ` David Pirotte
2017-10-13 15:14   ` David Pirotte
2017-10-13 14:35 ` David Pirotte [this message]
     [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=20171013113509.09cf6049@capac \
    --to=david@altosw.be \
    --cc=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).