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#20093: master: setting merge-generics duplicate-binding-handler @ expand time raises an error Date: Sun, 3 Jul 2016 01:57:49 -0300 Message-ID: <20160703015749.4538f751@capac> References: <20150312001718.5d1ae438@capac> <87k2hfopyc.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/eS+k0=GtOST760CYsuInJWe"; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1467521966 27171 80.91.229.3 (3 Jul 2016 04:59:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jul 2016 04:59:26 +0000 (UTC) Cc: 20093-done@debbugs.gnu.org To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Jul 03 06:59:15 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 1bJZUw-0005GE-C6 for guile-bugs@m.gmane.org; Sun, 03 Jul 2016 06:59:14 +0200 Original-Received: from localhost ([::1]:41237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJZUv-0003W2-A1 for guile-bugs@m.gmane.org; Sun, 03 Jul 2016 00:59:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJZUo-0003Vw-K6 for bug-guile@gnu.org; Sun, 03 Jul 2016 00:59:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJZUk-00044o-GP for bug-guile@gnu.org; Sun, 03 Jul 2016 00:59:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJZUk-00044k-CA for bug-guile@gnu.org; Sun, 03 Jul 2016 00:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bJZUk-0000SH-1v for bug-guile@gnu.org; Sun, 03 Jul 2016 00:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Pirotte Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 03 Jul 2016 04:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20093 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 20093-done@debbugs.gnu.org id=D20093.14675218841682 (code D ref 20093); Sun, 03 Jul 2016 04:59:02 +0000 Original-Received: (at 20093-done) by debbugs.gnu.org; 3 Jul 2016 04:58:04 +0000 Original-Received: from localhost ([127.0.0.1]:35058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJZTo-0000R4-9X for submit@debbugs.gnu.org; Sun, 03 Jul 2016 00:58:04 -0400 Original-Received: from maximusconfessor.all2all.org ([79.99.200.102]:52718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJZTl-0000Qc-TK for 20093-done@debbugs.gnu.org; Sun, 03 Jul 2016 00:58:02 -0400 Original-Received: from localhost (unknown [192.168.0.2]) by maximusconfessor.all2all.org (Postfix) with ESMTP id BB034A04C012; Sun, 3 Jul 2016 06:58:00 +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 ecuWO8FeAwkE; Sun, 3 Jul 2016 06:57:56 +0200 (CEST) Original-Received: from capac (unknown [177.43.7.247]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id 3209DA04C10B; Sun, 3 Jul 2016 06:57:54 +0200 (CEST) In-Reply-To: <87k2hfopyc.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:8270 Archived-At: --Sig_/eS+k0=GtOST760CYsuInJWe Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Andy, > This was interesting -- turned out that GOOPS imports `map' from (srfi > srfi-1), and it's also there from (guile-user). SRFI-1 specified it via > #:replace so all is well, no warnings. However merge-generics is itself > a generic which needs `map' to dispatch over its types (at first) and > then that recurses, leading to badness. Thanks, it fixed the bug wrt the example of the original message, but it se= ems it introduced a new bug, see below. > But, you say, I only specified the duplicates handler after loading > goops! Well indeed, but if a module didn't specify #:duplicates, its > duplicates handling was implicitly dynamically scoped to whatever the > current default-duplicates-handlers were. That seems bogus to me: the > module declares its imports and exports and a lack of a declaration of > #:duplicates indicates that the module is implicitly specifying the > duplicate handlers that are described in the manual. > In master I have changed the `default-duplicate-binding-handler' to > simply access the handlers for the current module, as that seems to be > the correct thing. Let me know how it goes! Closing as done but let's > follow up :) This is a big problem for me, so I partially locally reverted that part of the patch, plus, I patch guild so it does this before anything else: (eval-when (expand load eval) (use-modules (oop goops)) (default-duplicate-binding-handler '(merge-generics replace warn-override-core warn last))) This worked well with guile-2.0 [guild patched the same way I mean], but ra= ises a bug using guild from 2.2, that I can reproduce even not reverting anything = from your fix: if you patch guild the same way, just to try, then try to compile any file= that does even not use goops, it raises the same error As an example, let's create a reexport.scm [based on guile-gnome glib/gnome/gw/support/modules.scm] ;; reexport.scm starts here (define-module (reexport) #:export (re-export-public-interface)) (define-macro (re-export-public-interface . args) "Re-export the public interface of a module or modules. Invoked as @code{(re-export-public-interface (mod1) (mod2)...)}." (if (null? args) '(if #f #f) `(begin ,@(map (lambda (mod) (or (list? mod) (error "Invalid module specification" mod)) `(module-use! (module-public-interface (current-module)) (resolve-interface ',mod))) args)))) ;; reexport.scm ends here Then let's try to compile it using the patched guild as mentioned above: david@capac:~/gnu/grip/git/grip 5 $ which guild /opt2/bin/guild david@capac:~/gnu/grip/git/grip 6 $ guild compile reexport.scm=20 ;;; note: source file /opt2/bin/guild ;;; newer than compiled /home/david/.cache/guile/ccache/2.2-LE-8-3.9/= opt2/bin/guild.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /opt2/bin/guild ;;; WARNING: compilation of /opt2/bin/guild failed: ;;; ERROR: No applicable method for #< merge-generics (3)> in call= (merge-generics # format # # # # #f #f) Backtrace: In ice-9/eval.scm: 710:20 19 (primitive-eval (define (main args) (if (# (# #)) #) #)) In ice-9/psyntax.scm: 1199:22 18 (expand-top-sequence ((define (main args) (if (=E2=80=A6) =E2= =80=A6) =E2=80=A6)) =E2=80=A6) In ice-9/boot-9.scm: 224:17 17 (map1 (#)) In ice-9/psyntax.scm: 1374:12 16 (_) 1754:11 15 (lp (#(syntax-object (if (defined? (quote #)) #) # =E2=80=A6) = =E2=80=A6) =E2=80=A6) 1644:45 14 (parse _ _ _ _ _ _ _) In ice-9/boot-9.scm: 224:17 13 (map1 (((("placeholder" placeholder) ("=E2=80=A6" . #) =E2=80= =A6) . #) =E2=80=A6)) In ice-9/psyntax.scm: 1374:12 12 (_ _ _) 1449:23 11 (_ _ _) In ice-9/boot-9.scm: 224:29 10 (map1 ((quote system-error) (lambda () (setlocale =E2=80=A6)) = #)) 224:29 9 (map1 ((lambda () (setlocale LC_ALL "")) (lambda # #))) 224:17 8 (map1 ((lambda args (format (current-error-port) # #)))) In ice-9/psyntax.scm: 1754:11 7 (lp ((format (current-error-port) "warning: failed=E2=80=A6" = =E2=80=A6)) =E2=80=A6) 1577:33 6 (parse (((("placeholder" placeholder) ("=E2=80=A6" . #) =E2=80= =A6) . #)) =E2=80=A6) 1298:27 5 (syntax-type (format (current-error-port) "warning:=E2=80=A6" = =E2=80=A6) =E2=80=A6) 1282:39 4 (syntax-type format (("placeholder" placeholder) # # =E2=80=A6= ) =E2=80=A6) 302:24 3 (resolve-identifier _ _ (("placeholder" placeholder) =E2=80=A6= ) =E2=80=A6) In unknown file: 2 (module-variable # format) In oop/goops.scm: 1437:4 1 (cache-miss # format # =E2=80=A6) In unknown file: 0 (scm-error goops-error #f "No applicable method for ~S=E2=80= =A6" =E2=80=A6) ERROR: In procedure scm-error: ERROR: No applicable method for #< merge-generics (3)> in call (me= rge-generics # format # # # # #f #f) david@capac:~/gnu/grip/git/grip 7 $=20 NOW, let's ask guild to use --no-auto-compile #!/bin/sh # -*- scheme -*- exec ${GUILE:-/opt2/bin/guile} --no-auto-compile -e '(@@ (guild) main)' -s = "$0" "$@" !# ... ... And try again: david@capac:~/gnu/grip/git/grip 8 $ guild compile reexport.scm=20 ;;; note: source file /opt2/bin/guild ;;; newer than compiled /home/david/.cache/guile/ccache/2.2-LE-8-3.9/= opt2/bin/guild.go Backtrace: In ice-9/eval.scm: 710:20 19 (primitive-eval (define (main args) (if (# (# #)) #) #)) In ice-9/psyntax.scm: 1199:22 18 (expand-top-sequence ((define (main args) (if (=E2=80=A6) =E2= =80=A6) =E2=80=A6)) =E2=80=A6) In ice-9/boot-9.scm: 224:17 17 (map1 (#)) In ice-9/psyntax.scm: 1374:12 16 (_) 1754:11 15 (lp (#(syntax-object (if (defined? (quote #)) #) # =E2=80=A6) = =E2=80=A6) =E2=80=A6) 1644:45 14 (parse _ _ _ _ _ _ _) In ice-9/boot-9.scm: 224:17 13 (map1 (((("placeholder" placeholder) ("=E2=80=A6" . #) =E2=80= =A6) . #) =E2=80=A6)) In ice-9/psyntax.scm: 1374:12 12 (_ _ _) 1449:23 11 (_ _ _) In ice-9/boot-9.scm: 224:29 10 (map1 ((quote system-error) (lambda () (setlocale =E2=80=A6)) = #)) 224:29 9 (map1 ((lambda () (setlocale LC_ALL "")) (lambda # #))) 224:17 8 (map1 ((lambda args (format (current-error-port) # #)))) In ice-9/psyntax.scm: 1754:11 7 (lp ((format (current-error-port) "warning: failed=E2=80=A6" = =E2=80=A6)) =E2=80=A6) 1577:33 6 (parse (((("placeholder" placeholder) ("=E2=80=A6" . #) =E2=80= =A6) . #)) =E2=80=A6) 1298:27 5 (syntax-type (format (current-error-port) "warning:=E2=80=A6" = =E2=80=A6) =E2=80=A6) 1282:39 4 (syntax-type format (("placeholder" placeholder) # # =E2=80=A6= ) =E2=80=A6) 302:24 3 (resolve-identifier _ _ (("placeholder" placeholder) =E2=80=A6= ) =E2=80=A6) In unknown file: 2 (module-variable # format) In oop/goops.scm: 1437:4 1 (cache-miss # format # =E2=80=A6) In unknown file: 0 (scm-error goops-error #f "No applicable method for ~S=E2=80= =A6" =E2=80=A6) ERROR: In procedure scm-error: ERROR: No applicable method for #< merge-generics (3)> in call (me= rge-generics # format # # # # #f #f) david@capac:~/gnu/grip/git/grip 9 $=20 BUT THIS Works:fine, in case it gives you come idea [it raises a warning th= ough, is this warning expected?] david@capac:~/alto/projects/guile-tests/goops 3 $ guile GNU Guile 2.1.3.52-8a087 Copyright (C) 1995-2016 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> ,use (oop goops) scheme@(guile-user)> (default-duplicate-binding-handler '(merge-generics replace warn-override-core warn last)) ;;; warning: unknown warning type `macro-use-before-definition' $1 =3D (#< merge-generics (3)> # # # #) scheme@(guile-user)> ,use (system base compile) scheme@(guile-user)> (compile-file "/home/david/gnu/grip/git/grip/reexport.= scm") ;;; warning: unknown warning type `macro-use-before-definition' $2 =3D "/home/david/.cache/guile/ccache/2.2-LE-8-3.9/usr/alto/projects/gnu/= grip/git/grip/reexport.scm.go" scheme@(guile-user)>=20 Sorry for the long email! I hope you can help! Cheers, David --Sig_/eS+k0=GtOST760CYsuInJWe Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXeJtNAAoJEPN0/ZOjBXrXQJIIAK/GqPGPveZI32ZPAcOSGVS4 oONorVkMa8W6qad9hpC1MvqTlug07Z6ULpn66p3I+4gp/7xPbOgo/5bXbL8eE2Z4 L2Q9Z7sLXBWUIm4AZ2BboM5UwnY9hZtZGMSWpHW+4SlwCU51G9B3DPd3kGJJtAb5 0hjY9k3LEmI0B2E9IYMR++Q4IWZ2nyIDEKeGs80Nju6rff3SQ11In2W5/OXhImg6 vi67JT9V5FanBnmyYiALi+BePRMnWrKK0v/X1yLqgH8E679/FbG1BzkYyudBV9RF 7MkDiCc8ap/r3atGhA72pKf28ydCogEdO5bH1pEitfQ7cfJ/wdSDs2z3UQAZywA= =t0r/ -----END PGP SIGNATURE----- --Sig_/eS+k0=GtOST760CYsuInJWe--