* goops: default-duplicate-binding-handler 'does not work' when global [i.e. in init.scm]
@ 2011-08-20 22:56 David Pirotte
2011-08-27 13:02 ` Andy Wingo
0 siblings, 1 reply; 2+ messages in thread
From: David Pirotte @ 2011-08-20 22:56 UTC (permalink / raw)
To: bug-guile
[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]
Hello,
I've noticed that the following attached code [slightly modified since my previous
related message] only works if the third module also specify:
:duplicates (merge-generics
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 goops
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 track of 2
sessions, to illustrate [which I edited manually after pasting here to reduce 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 reproduce]
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 = (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 = 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 #<<accessor> dialog (1)> in call (dialog #<<widget-b> 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 #<<accessor> dialog (1)> (#<<widget-b> 8677a80>))
In unknown file:
0 (scm-error goops-error #f "No applicable method for ~S in call
~S" (#<<accessor>…> …) …)
[-- Attachment #2: mg-1.scm --]
[-- Type: text/x-scheme, Size: 273 bytes --]
(define-module (mg-1)
:use-module (oop goops)
:export (<widget-a>
dialog
make-widget-a
))
(define-class <widget-a> ()
(dialog :accessor dialog :init-keyword :dialog :init-value #f))
(define (make-widget-a)
(make <widget-a> :dialog 'dialog-a))
[-- Attachment #3: mg-2.scm --]
[-- Type: text/x-scheme, Size: 622 bytes --]
(define-module (mg-2)
:use-module (oop goops)
:export (<widget-b>
dialog
make-widget-b
))
(define-class <widget-b> ()
(dialog :accessor dialog :init-keyword :dialog :init-value #f))
(define (make-widget-b)
(make <widget-b> :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)
!#
[-- Attachment #4: mg-3.scm --]
[-- Type: text/x-scheme, Size: 674 bytes --]
(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 <widget-a>))
(define b (make <widget-b>))
(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)
!#
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: goops: default-duplicate-binding-handler 'does not work' when global [i.e. in init.scm]
2011-08-20 22:56 goops: default-duplicate-binding-handler 'does not work' when global [i.e. in init.scm] David Pirotte
@ 2011-08-27 13:02 ` Andy Wingo
0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2011-08-27 13:02 UTC (permalink / raw)
To: David Pirotte; +Cc: bug-guile
On Sun 21 Aug 2011 00:56, David Pirotte <david@altosw.be> writes:
> 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 goops
> behavior I think it should [unless I missed something]
Did you import (oop goops) beforehand, in your init.scm?
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-27 13:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-20 22:56 goops: default-duplicate-binding-handler 'does not work' when global [i.e. in init.scm] David Pirotte
2011-08-27 13:02 ` Andy Wingo
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).