From: David Pirotte <david@altosw.be>
To: Andrew Erlanger <andrew.erlanger@gmail.com>,
guile-user <guile-user@gnu.org>
Subject: Re: Problem merging generics across modules
Date: Tue, 17 Oct 2017 21:23:28 -0200 [thread overview]
Message-ID: <20171017212328.2e756f4e@capac> (raw)
In-Reply-To: <874lqxbgnf.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me>
[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]
Hi Andrew,
Lets try to keep our conversation about this o the list, others may benefit
from it, and/or help us ...
> Thanks for your feedback on this. It certainly resolved my issue.
Welcome.
> Can you point me to documentation on this? I read through the Guile info
> pages when trying to figure this out, but I couldn't figure it out.
> ...
No, there is no 'good' documentation neither recommendation(s) about 'generic
functions and the module system' in guile's manual - I mean 'no good' in my opinion,
but this is 'relative', and besides, some guilers are opposed to these
recommendations I always 'offer', but here they are:
1] better preventing then curing: when you define a module that use goops,
always use
#:duplicates (merge-generics
replace
warn-override-core
warn
last)
2] unless you really know what you are doing, never call define-generic
yourself
3] always use #:export for class names, and make sure class names are
unique (guile will warn you if not, at import time, so rename if you
have conflict, never use twice the same class name in diff modules (unless
you really know what you're doing))
4] always use g-export for (and only for) getters, setters, accessors and
methods
https://git.savannah.gnu.org/cgit/guile-cv.git/tree/cv/support/g-export.scm
5] remember, while you are developing and testing your code, you have to add
'merge-generics to the default-duplicate-binding-handler in the repl as well,
_after_ you imported goops (in the repl):
,use (oop goops)
(default-duplicate-binding-handler
'(merge-generics replace warn-override-core warn last))
(use-modules (yourmod1) (yourmod2))
With these recommendations, you actually 'mimic' [1] the CLOS specification, which
states that anything related to CLOS lands in a specific package, visible to all
others.
David
[1] mimic because unlike CLOS, a generic function in a guile module will
only contain methods that comes from that module and the one it
imports, but not (necessarily) all methods for that name (unless the module
imports all the others that define a method for that name of course)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2017-10-17 23:23 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
[not found] ` <874lqxbgnf.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me>
2017-10-17 23:23 ` David Pirotte [this message]
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=20171017212328.2e756f4e@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).