From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Pirotte Newsgroups: gmane.lisp.guile.user Subject: Re: Problem merging generics across modules Date: Tue, 17 Oct 2017 21:23:28 -0200 Message-ID: <20171017212328.2e756f4e@capac> References: <8760bjncez.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me> <20171013113509.09cf6049@capac> <874lqxbgnf.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/K1Lv=s_=MQPWk5G0Bwatwfc"; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1508282662 16966 195.159.176.226 (17 Oct 2017 23:24:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 17 Oct 2017 23:24:22 +0000 (UTC) To: Andrew Erlanger , guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Oct 18 01:24:10 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4bDV-0002pZ-2f for guile-user@m.gmane.org; Wed, 18 Oct 2017 01:24:09 +0200 Original-Received: from localhost ([::1]:41866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4bDc-0008PH-3M for guile-user@m.gmane.org; Tue, 17 Oct 2017 19:24:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4bDF-0008Nx-7v for guile-user@gnu.org; Tue, 17 Oct 2017 19:23:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4bDC-00062u-1l for guile-user@gnu.org; Tue, 17 Oct 2017 19:23:53 -0400 Original-Received: from maximusconfessor.all2all.org ([79.99.200.102]:42795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4bDB-00061i-P6 for guile-user@gnu.org; Tue, 17 Oct 2017 19:23:49 -0400 Original-Received: from localhost (unknown [192.168.0.2]) by maximusconfessor.all2all.org (Postfix) with ESMTP id E6261A04C114; Wed, 18 Oct 2017 01:23:46 +0200 (CEST) Original-Received: from maximusconfessor.all2all.org ([192.168.0.1]) by localhost (maximusconfessor.all2all.org [192.168.0.2]) (amavisd-new, port 10024) with ESMTP id hym-Fp2NdyHU; Wed, 18 Oct 2017 01:23:41 +0200 (CEST) Original-Received: from capac (unknown [179.210.16.28]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id E3A81A04C10B; Wed, 18 Oct 2017 01:23:40 +0200 (CEST) In-Reply-To: <874lqxbgnf.fsf@ateguix.i-did-not-set--mail-host-address--so-tickle-me> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 79.99.200.102 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14216 Archived-At: --Sig_/K1Lv=s_=MQPWk5G0Bwatwfc Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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 'gener= ic 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 we= ll, _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 t= o 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) --Sig_/K1Lv=s_=MQPWk5G0Bwatwfc Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEhCJlRZtBM3furJHe83T9k6MFetcFAlnmkPAACgkQ83T9k6MF etd2twgAhjl0Nb5PSL6lwLBkma2BBP82eZWeF2Ajl1W5VEoT3Xi2xm0anHb1qHtj 6+vVtUA/JAQz1RZpHMcFjYm7NEeUqzp7QqlDtQqv0bMgnKT0Q0CtpAEnGEAOdrLv 8lUJMb5kPb9NbL+XXslrNVN8osQVJzepHKdy5c57djcamtYxW7X5Zyeog2ar2qGb rNhn5qs3S4kaSQjq+KLEoGzYjcdCMszjhYClJhGJI5ucqzEWz4YfJ7BT8+VZJvto fYOPpq2FYR36AeNVe1KtCAlCbWDHv0qOhH6eBRUj775hhDalT2y5BdvAZwxMMmEa vkBJfAL7H2xaki/d9CSSsMHKZ0z4Kg== =xgDn -----END PGP SIGNATURE----- --Sig_/K1Lv=s_=MQPWk5G0Bwatwfc--