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: goops: default-duplicate-binding-handler 'does not work' when global [i.e. in init.scm] Date: Sat, 20 Aug 2011 19:56:14 -0300 Message-ID: <20110820195614.36a5b4a2@rascar> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/bdMH+9ruul.CAuoJcZXiEJI" X-Trace: dough.gmane.org 1313881001 31847 80.91.229.12 (20 Aug 2011 22:56:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 20 Aug 2011 22:56:41 +0000 (UTC) To: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Aug 21 00:56:32 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QuuSt-00030d-Tm for guile-bugs@m.gmane.org; Sun, 21 Aug 2011 00:56:32 +0200 Original-Received: from localhost ([::1]:37791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QuuSt-0005gp-Eu for guile-bugs@m.gmane.org; Sat, 20 Aug 2011 18:56:31 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:43312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QuuSq-0005gY-BS for bug-guile@gnu.org; Sat, 20 Aug 2011 18:56:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QuuSp-0000XO-8L for bug-guile@gnu.org; Sat, 20 Aug 2011 18:56:28 -0400 Original-Received: from maximusconfessor.all2all.org ([62.58.108.13]:33691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QuuSo-0000XH-Tt for bug-guile@gnu.org; Sat, 20 Aug 2011 18:56:27 -0400 Original-Received: from localhost (unknown [192.168.0.2]) by maximusconfessor.all2all.org (Postfix) with ESMTP id 2A5D6A04C2DB for ; Sun, 21 Aug 2011 00:56:25 +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 2Jlp7haWKub0 for ; Sun, 21 Aug 2011 00:36:57 +0200 (CEST) Original-Received: from rascar (unknown [189.60.180.75]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id CF66FA04C2C0 for ; Sun, 21 Aug 2011 00:56:17 +0200 (CEST) X-Mailer: Claws Mail 3.7.9 (GTK+ 2.24.4; i486-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 62.58.108.13 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.14 Precedence: list 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-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5788 Archived-At: --MP_/bdMH+9ruul.CAuoJcZXiEJI Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello, I've noticed that the following attached code [slightly modified since my p= revious related message] only works if the third module also specify: :duplicates (merge-generics=20 replace warn-override-core warn last) ;; [which I deleted from the define-module precisely so to raise the bug This means that the following form (default-duplicate-binding-handler '(merge-generics replace warn-override-core warn last)) which I added to my init.scm file, does not produce the expected global goo= ps behavior I think it should [unless I missed something] As a consequence, if you use-modules 'manually in the repl, then depending = on the order of your use-modules sequence, you also face this same bug [since the = repl only depend on the global default-duplicate-binding-handler setting. Here is a t= rack of 2 sessions, to illustrate [which I edited manually after pasting here to redu= ce to essential input/output] [Note: of course you'll have to add the above default-duplicate-binding-handler call in your init.scm in order to reprod= uce] Thanks, David ;;; ;;; The first session ;;; david@rascar:~/alto/projects/kise 23 $ guile GNU Guile 2.0.2.49-6b1c5 ... scheme@(guile-user)> (default-duplicate-binding-handler) (default-duplicate-binding-handler) $1 =3D (merge-generics replace warn-override-core warn last) scheme@(guile-user)> (use-modules (mg-1) (mg-2)) (define widget (make-widget-b)) (dialog widget) WARNING: (guile-user): `dialog' imported from both (mg-1) and (mg-2) $2 =3D dialog-b scheme@(guile-user)> ,q ;;; ;;; The second ;;; david@rascar:~/alto/projects/kise 24 $ guile scheme@(guile-user)> (use-modules (mg-2) (mg-1)) (define widget (make-widget-b)) (dialog widget) WARNING: (guile-user): `dialog' imported from both (mg-2) and (mg-1) ERROR: In procedure scm-error: ERROR: No applicable method for #< dialog (1)> in call (dialog #<= 8677a80>) Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> ,bt In oop/goops/dispatch.scm: 231:9 1 (cache-miss #< dialog (1)> (#< 8677a80>)) In unknown file: 0 (scm-error goops-error #f "No applicable method for ~S in call ~S" (#<=E2=80=A6> =E2=80=A6) =E2=80=A6) --MP_/bdMH+9ruul.CAuoJcZXiEJI Content-Type: text/x-scheme Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=mg-1.scm (define-module (mg-1) :use-module (oop goops) :export ( dialog make-widget-a )) (define-class () (dialog :accessor dialog :init-keyword :dialog :init-value #f)) (define (make-widget-a) (make :dialog 'dialog-a)) --MP_/bdMH+9ruul.CAuoJcZXiEJI Content-Type: text/x-scheme Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=mg-2.scm (define-module (mg-2) :use-module (oop goops) :export ( dialog make-widget-b )) (define-class () (dialog :accessor dialog :init-keyword :dialog :init-value #f)) (define (make-widget-b) (make :dialog 'dialog-b)) #! (use-modules (macros push)) (push! "/usr/local/share/guile/alto/2.0/tests" %load-path) ;;; ;;; Test multiple imports - 1 ;;; (use-modules (mg-1) (mg-2)) (define widget (make-widget-b)) (dialog widget) ;;; ;;; Test multiple imports - 2 ;;; (use-modules (mg-2) (mg-1)) (define widget (make-widget-b)) (dialog widget) !# --MP_/bdMH+9ruul.CAuoJcZXiEJI Content-Type: text/x-scheme Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=mg-3.scm (define-module (mg-3) :use-module (ice-9 format) :use-module (oop goops) :use-module (mg-1) :use-module (mg-2) :export (a b letstry)) (define a (make )) (define b (make )) (define (letstry) (format #t "Dialog a: ~S~%" (dialog a)) (format #t "Dialog b: ~S~%" (dialog b))) #! (use-modules (macros push)) (push! "/usr/local/share/guile/alto/2.0/tests" %load-path) (use-modules (mg-3)) (letstry) ;;; ;;; now in init.scm ;;; (default-duplicate-binding-handler ;;; '(merge-generics replace warn-override-core warn last)) :duplicates (merge-generics replace warn-override-core warn last) !# --MP_/bdMH+9ruul.CAuoJcZXiEJI--