From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Pirotte Newsgroups: gmane.lisp.guile.bugs Subject: bug#19459: #:export does not honor the merge-generics contract Date: Thu, 23 Jun 2016 16:23:21 -0300 Message-ID: <20160623162321.448e47af@capac> References: <20141228162024.048ca208@capac> <87vb11q8ir.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/hVPSJ7QlDNQRLHp8jXzEfYl"; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1466709873 7251 80.91.229.3 (23 Jun 2016 19:24:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jun 2016 19:24:33 +0000 (UTC) Cc: 19459@debbugs.gnu.org To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Jun 23 21:24:22 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bGAEc-0005e6-T4 for guile-bugs@m.gmane.org; Thu, 23 Jun 2016 21:24:19 +0200 Original-Received: from localhost ([::1]:38901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGAEb-0004pY-LL for guile-bugs@m.gmane.org; Thu, 23 Jun 2016 15:24:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGAES-0004nF-J0 for bug-guile@gnu.org; Thu, 23 Jun 2016 15:24:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGAEM-0005dh-Fb for bug-guile@gnu.org; Thu, 23 Jun 2016 15:24:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGAEM-0005dc-Be for bug-guile@gnu.org; Thu, 23 Jun 2016 15:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bGAEM-0004ID-7u for bug-guile@gnu.org; Thu, 23 Jun 2016 15:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Pirotte Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 23 Jun 2016 19:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19459 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 19459-submit@debbugs.gnu.org id=B19459.146670982016471 (code B ref 19459); Thu, 23 Jun 2016 19:24:02 +0000 Original-Received: (at 19459) by debbugs.gnu.org; 23 Jun 2016 19:23:40 +0000 Original-Received: from localhost ([127.0.0.1]:52998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGAE0-0004Hb-AF for submit@debbugs.gnu.org; Thu, 23 Jun 2016 15:23:40 -0400 Original-Received: from maximusconfessor.all2all.org ([79.99.200.102]:53415) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGADy-0004HS-5E for 19459@debbugs.gnu.org; Thu, 23 Jun 2016 15:23:38 -0400 Original-Received: from localhost (unknown [192.168.0.2]) by maximusconfessor.all2all.org (Postfix) with ESMTP id 31661A04C13D; Thu, 23 Jun 2016 21:23:36 +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 ppjsVzsImVpd; Thu, 23 Jun 2016 21:23:31 +0200 (CEST) Original-Received: from capac (unknown [179.210.35.216]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id A3C25A04C13F; Thu, 23 Jun 2016 21:23:30 +0200 (CEST) In-Reply-To: <87vb11q8ir.fsf@pobox.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8180 Archived-At: --Sig_/hVPSJ7QlDNQRLHp8jXzEfYl Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Andy, > > (define-module (a) > > #:use-module (oop goops) > > #:export ( > > !width > > get-width > > set-width)) =20 > Here you export four bindings: one class and three generics. Those > three generics have methods on . > > (define-module (b) > > #:use-module (oop goops) > > #:use-module (a) =20 > Here you import the previous four bindings. > > #:export ( > > !width > > get-width > > set-width)) =20 > However here you declare that you are going to export four new > bindings. > ... Under the exact circumstances of the original email, I disagree, see below. From the original email, you only kept the module defs and explains here i= n your answer the expected behavior in normal circumstances: the behavior one can expect from the default Guile configuration. Fine, but that's not the what the original email was complaining about :) > AFAIU there is no bug here. David WDYT? IMO it is a bug, and to be honest, IMO it is a serious one: a user should n= ever have to use #:re-export for generic functions once he/she did ask to merge dupli= cate generics, because under this setting, there can be 1 and only 1 generic fun= ction, at any time in any module. Under these circumstances, it is the generic functi= on as the module 'sees it' that the user export, not the generic function as the modu= le sees it before import(s) if imported, then that generic is 'filled in' with new methods, it is _not_ created [should not be created], hence #:export is the 'culprit', because = as it is it does not look if a generic exists and create a new one arbitraril= y, against the user 'wish'. It can only do so if there is no imported one. So, IMO, under the '(merge-generics ...) setting of the original email (b) = exports 1 new binding and 3 generic functions that were already defined by (a), but/a= nd 'filled' with 3 additional methods. The module (b) exports the generic func= tion 'as it has it'. There is another way, maybe, to look at this anomaly: if you comment the ex= port for get-width and set-width from the (b) module, it works: scheme@(guile-user)> ,use (b) scheme@(guile-user)> (make ) $4 =3D #< 2051a40> because within the module (b), the generics set-width and get-width were im= ported from (a), not created [or 'immediately' merged, implementation detail...], = and filed with the (b) methods. #:export however dismantle this to export a new gener= ic [but the user ask to merge them, so it breaks the user 'contract'] only containi= ng the (b) methods, which is a bug. Last but not least, when a user imports (b) and run (make ), he is not h= imself calling set-width or get-width: exported or not, the code being run by make= should run within the (b) module, and in the (b) module the generic functions have= been merged,, so can not [should] raise an error. If you follow your idea/positi= on, it should only raise an error if I do (get-width (make )) [but then the sys= tem might raise the undefined class first..., but you get the idea I guess. FIWIW, It's been years that I don't use #:export because of this bug, I def= ined my own g-export syntax, based on guile's module source code, here: http://git.savannah.gnu.org/cgit/grip.git/tree/grip/g-export.scm It would be really good if it be fixed in 2.0.12 and master though. Cheers, David --Sig_/hVPSJ7QlDNQRLHp8jXzEfYl Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXbDcpAAoJEPN0/ZOjBXrXhPMH/REXriGmZ/2ClsL1fRKQ03FI vq67r/ZZS4V+oHvFhtXY8/crhKJdlo89LydsvBIWPn0zM3XAoCjFdCFjgvbUJrFe 5+CFH4n/D3ii9pjRqawRU7cGZHs9epgatmZEcCl+Gx/A1zkK17eMgXthYtR2hcxy SO8R1E4t1qJvir1GK9bmX1Lu0NnZ/JD6mT+qDoVFNU88H2hvSsAxYH/8eh7kLCz+ CSL/Q4qzRPnEiHeGVadjq8UwhW0Qa1msh2p/IeWfTMMpoP8cE5fMNPLacImEOhSX fOvSD4aylrGRZjyYGCvDmGb9/NCAcgnV1YT2/rUSuqwn/5ouw4CfwPQnjj1XtX4= =/hoT -----END PGP SIGNATURE----- --Sig_/hVPSJ7QlDNQRLHp8jXzEfYl--