unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* module system / (oop goops) / :duplicates (merge-generics) / bug?
@ 2011-07-05 21:32 David Pirotte
  2011-07-06 16:17 ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: David Pirotte @ 2011-07-05 21:32 UTC (permalink / raw)
  To: bug-guile

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

Hello,

Can someone kindly look at this small example and tell me what's wrong? I get this

	david@rascar:~ 8 $ guile
	GNU Guile 2.0.0.160-39be
	...
	scheme@(guile-user)> (use-modules (mg-3))
	(letstry)

	mg-3.scm:17:2: In procedure letstry:
	mg-3.scm:17:2: In procedure module-lookup: Unbound variable: dialog

	Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
	

Many thanks,
David

ps:	sometimes guile does not 'comeback from an error' with a prompt
	invitation, like in my case here above: the guile-prompt only come back
	after I enter something, like ,q in this case.


[-- Attachment #2: mg-1.scm --]
[-- Type: text/x-scheme, Size: 232 bytes --]


(define-module (mg-1)
  :use-module (oop goops)

  :duplicates (merge-generics)

  :export (<widget-a>
	    dialog
	    ))



(define-class <widget-a> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value 'dialog-a)
  )


[-- Attachment #3: mg-2.scm --]
[-- Type: text/x-scheme, Size: 233 bytes --]


(define-module (mg-2)
  :use-module (oop goops)

  :duplicates (merge-generics)

  :export (<widget-b>
	    dialog
	    ))



(define-class <widget-b> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value 'dialog-b)
  )



[-- Attachment #4: mg-3.scm --]
[-- Type: text/x-scheme, Size: 399 bytes --]


(define-module (mg-3)
  :use-module (oop goops)
  :use-module (mg-1)
  :use-module (mg-2)

  :duplicates (merge-generics)

  :export (a
	   b
	   letstry))


(define a (make <widget-a>))
(define b (make <widget-b>))

(define (letstry)
  (dialog a)
  (dialog b))


#!

(use-modules (macros push))
(push! "/usr/local/share/guile/alto/2.0/tests"
       %load-path)

(use-modules (mg-3))
(letstry)

!#

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-05 21:32 module system / (oop goops) / :duplicates (merge-generics) / bug? David Pirotte
@ 2011-07-06 16:17 ` Ludovic Courtès
  2011-07-06 19:22   ` David Pirotte
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2011-07-06 16:17 UTC (permalink / raw)
  To: David Pirotte; +Cc: bug-guile

Hi David,

David Pirotte <david@altosw.be> skribis:

> Can someone kindly look at this small example and tell me what's wrong? I get this
>
> 	david@rascar:~ 8 $ guile
> 	GNU Guile 2.0.0.160-39be

I think commit ad4bd7c2c0c931a91160772e5ebf40af0f471874 (in 2.0.2) fixes
this.  Can you check with 2.0.2?

Thanks,
Ludo’.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-06 16:17 ` Ludovic Courtès
@ 2011-07-06 19:22   ` David Pirotte
  2011-07-07 11:37     ` Andy Wingo
  0 siblings, 1 reply; 18+ messages in thread
From: David Pirotte @ 2011-07-06 19:22 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guile

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]

Hello Ludovic,

> > 	david@rascar:~ 8 $ guile
> > 	GNU Guile 2.0.0.160-39be
> 
> I think commit ad4bd7c2c0c931a91160772e5ebf40af0f471874 (in 2.0.2) fixes
> this.  Can you check with 2.0.2?

  [I should have pulled the latest off course, I am sorry]

I slightly modified the mg-*.scm files:

	mg-1 and mg-2:

	[a]	did not need to use :duplicates;
	[b]	I commented out define-generic, on purpose, since it is my
		understanding [is it right?] that :accessor will do it for me;

	mg-3:

	[c]	added (ice-9 format) in mg-3 since it did show
		'another' [maybe] problem.

I got the same errors:

1] with (ice-9 format):

david@asterix:/usr/local/share/guile/alto/2.0/tests 1 $ guile
GNU Guile 2.0.2.3-21b6d
...
scheme@(guile-user)> (use-modules (mg-3))
(letstry)

mg-3.scm:19:2: In procedure letstry:
mg-3.scm:19:2: In procedure module-lookup: Unbound variable: format

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.

2] without:

..
(use-modules (mg-3))                                                                                    
(letstry)                                                                                               
..
mg-3.scm:19:30: In procedure letstry:
mg-3.scm:19:30: In procedure module-lookup: Unbound variable: dialog


Cheers,
David

[-- Attachment #2: mg-1.scm --]
[-- Type: text/x-scheme, Size: 256 bytes --]


(define-module (mg-1)
  :use-module (oop goops)

  :duplicates (merge-generics)

  :export (<widget-a>
	    dialog
	    ))


(define-generic dialog)

(define-class <widget-a> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value 'dialog-a)
  )


[-- Attachment #3: mg-2.scm --]
[-- Type: text/x-scheme, Size: 256 bytes --]


(define-module (mg-2)
  :use-module (oop goops)

  :duplicates (merge-generics)

  :export (<widget-b>
	    dialog
	    ))

(define-generic dialog)

(define-class <widget-b> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value 'dialog-b)
  )



[-- Attachment #4: mg-3.scm --]
[-- Type: text/x-scheme, Size: 486 bytes --]


(define-module (mg-3)
  :use-module (ice-9 format)
  :use-module (oop goops)
  :use-module (mg-1)
  :use-module (mg-2)

  :duplicates (merge-generics)

  :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)

!#

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-06 19:22   ` David Pirotte
@ 2011-07-07 11:37     ` Andy Wingo
  2011-07-07 16:26       ` David Pirotte
  0 siblings, 1 reply; 18+ messages in thread
From: Andy Wingo @ 2011-07-07 11:37 UTC (permalink / raw)
  To: David Pirotte; +Cc: bug-guile, Ludovic Courtès

Hi David,

A few notes apart from Ludovic's excellent suggestions.

On Wed 06 Jul 2011 21:22, David Pirotte <david@altosw.be> writes:

> (define-module (mg-1)
>   :use-module (oop goops)
>
>   :duplicates (merge-generics)
>
>   :export (<widget-a>
> 	    dialog
> 	    ))

Here the #:duplicates is unnecessary, because you are not importing any
duplicate bindings.

> (define-module (mg-3)
>   :use-module (ice-9 format)
>   :use-module (oop goops)
>   :use-module (mg-1)
>   :use-module (mg-2)
>
>   :duplicates (merge-generics)
>
>   :export (a
> 	   b
> 	   letstry))

But here you need other duplicates handlers, not just merge-generics;
merge-generics doesn't handle the other (default-duplicates-handlers).

So you could change to have:

  #:duplicates (merge-generics replace warn-override-core warn last)

But even now it didn't work, because of some deep bugs that have been
lurking in merge-generics support since 2007 at least (though not
present in 1.8).  I believe I have fixed these; can you update and test?

Thanks,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-07 11:37     ` Andy Wingo
@ 2011-07-07 16:26       ` David Pirotte
  2011-07-07 20:59         ` Andy Wingo
  0 siblings, 1 reply; 18+ messages in thread
From: David Pirotte @ 2011-07-07 16:26 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile, Ludovic Courtès

Hello Andy,
Ludovic,

...
> > (define-module (mg-1)
> >   :use-module (oop goops)
> >
> >   :duplicates (merge-generics)
> >
> >   :export (<widget-a>
> > 	    dialog
> > 	    ))
> 
> Here the #:duplicates is unnecessary, because you are not importing any
> duplicate bindings.

Yes, I think our messages 'crossed' somehow, as you probably know by now, I did
posted a slightly modified version of this small example while answering Ludovic ...
but thanks.

...
> But here you need other duplicates handlers, not just merge-generics;
> merge-generics doesn't handle the other (default-duplicates-handlers).
> 
> So you could change to have:
> 
>   #:duplicates (merge-generics replace warn-override-core warn last)
> 
> But even now it didn't work, because of some deep bugs that have been
> lurking in merge-generics support since 2007 at least (though not
> present in 1.8).  I believe I have fixed these; can you update and test?

Yes, it works, great!

Now, in order to make  (merge-generics replace warn-override-core warn last)
'my' default, i.e. in my init.scm, what should I do? 

I looked at boot-9.scm, but it's unclear to me, since it's not just a list of
symbols but calls make-mutable-parameter which I am unfamiliar with. Also, is
merge-generics 'defined' so that modules not using (oop goops) will still 'be happy'?

So the question is, would it be possible to configure [init.scm] guile in a way that
it automatically sets, when a module is using (oop goops), that the
(default-duplicate-binding-handler) then returns the above?

Many thanks,
David



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-07 16:26       ` David Pirotte
@ 2011-07-07 20:59         ` Andy Wingo
  2011-07-08 17:05           ` David Pirotte
  0 siblings, 1 reply; 18+ messages in thread
From: Andy Wingo @ 2011-07-07 20:59 UTC (permalink / raw)
  To: David Pirotte; +Cc: bug-guile, Ludovic Courtès

On Thu 07 Jul 2011 18:26, David Pirotte <david@altosw.be> writes:

> Now, in order to make  (merge-generics replace warn-override-core warn last)
> 'my' default, i.e. in my init.scm, what should I do? 

Invoke:

  (default-duplicate-binding-handler
    '(merge-generics replace warn-override-core warn last))

Regards,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-07 20:59         ` Andy Wingo
@ 2011-07-08 17:05           ` David Pirotte
  2011-07-09 10:02             ` Andy Wingo
  0 siblings, 1 reply; 18+ messages in thread
From: David Pirotte @ 2011-07-08 17:05 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile, Ludovic Courtès

Hello Andy,

> Invoke:
> 
>   (default-duplicate-binding-handler
>     '(merge-generics replace warn-override-core warn last))

This is not 'so important' anymore, but for bug tracking purposes, please note that
adding the above in my init.scm file and commenting the #:duplicates (...)
expression leads to the known error:


david@asterix:/usr/local/share/guile/alto/2.0/tests 4 $ guile
GNU Guile 2.0.2.3-21b6d
...
scheme@(guile-user)>  (default-duplicate-binding-handler)
$1 = (merge-generics replace warn-override-core warn last)
scheme@(guile-user)> (use-modules (mg-3))                                                                                                                 
(letstry)

WARNING: (mg-3): `dialog' imported from both (mg-1) and (mg-2)
ERROR: In procedure scm-error:
ERROR: No applicable method for #<<accessor> dialog (1)> in call (dialog #<<widget-a> 933bd70>)

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
,bt
In mg-3.scm:
    18:30  2 (letstry)
In oop/goops/dispatch.scm:
    231:9  1 (cache-miss #<<accessor> dialog (1)> (#<<widget-a> 933bd70>))
In unknown file:
           0 (scm-error goops-error #f "No applicable method for ~S in call ~S" (#<<accessor> dialog (1)> (dialog #<<widget-…>)) #)
scheme@(guile-user) [1]> 



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-08 17:05           ` David Pirotte
@ 2011-07-09 10:02             ` Andy Wingo
  2011-07-09 15:08               ` David Pirotte
  0 siblings, 1 reply; 18+ messages in thread
From: Andy Wingo @ 2011-07-09 10:02 UTC (permalink / raw)
  To: David Pirotte; +Cc: bug-guile, Ludovic Courtès

On Fri 08 Jul 2011 19:05, David Pirotte <david@altosw.be> writes:

> Hello Andy,
>
>> Invoke:
>> 
>>   (default-duplicate-binding-handler
>>     '(merge-generics replace warn-override-core warn last))
>
> This is not 'so important' anymore, but for bug tracking purposes, please note that
> adding the above in my init.scm file and commenting the #:duplicates (...)
> expression leads to the known error:
>
>
> david@asterix:/usr/local/share/guile/alto/2.0/tests 4 $ guile
> GNU Guile 2.0.2.3-21b6d

Git pull, please :).  You still don't have some recent fixes.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-09 10:02             ` Andy Wingo
@ 2011-07-09 15:08               ` David Pirotte
  2011-07-11 15:49                 ` Andy Wingo
  0 siblings, 1 reply; 18+ messages in thread
From: David Pirotte @ 2011-07-09 15:08 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile, Ludovic Courtès

Hi Andy,

> >>   (default-duplicate-binding-handler
> >>     '(merge-generics replace warn-override-core warn last))
> >
> > This is not 'so important' anymore, but for bug tracking purposes, please note
> > that adding the above in my init.scm file and commenting the #:duplicates (...)
> > expression leads to the known error:

> Git pull, please :).  You still don't have some recent fixes.

I am pulling :) Do you mean I have to checkout an unstable? [if yes, please tell me
what branch/version, I am git [very] 'limited' @ the moment :)

	david@asterix:/usr/local/share/guile/alto/2.0/tests 12 $ guile
	GNU Guile 2.0.2.3-21b6d
	scheme@(guile-user)> (use-modules (mg-3))
	(letstry)
	WARNING: (mg-3): `dialog' imported from both (mg-1) and (mg-2)
	ERROR: In procedure scm-error:
	ERROR: No applicable method for #<<accessor> dialog (1)> in call (dialog #<<widget-a> 8aaa390>)

Thanks,
David

Also, it's not working on this machine either [and I don't uderstand why guile versions
are different? surely I didn't do the right thing with git?]:

	david@rascar:/usr/local/src/guile/git-clone 4 $ git describe
	v2.0.2-7-gae88d9b
	david@rascar:/usr/local/src/guile/git-clone 5 $ git pull
	Already up-to-date.
	david@rascar:/usr/local/src/guile/git-clone 6 $ guile
	GNU Guile 2.0.2.7-ae88d
	...
	scheme@(guile-user)> (default-duplicate-binding-handler)
	$1 = (merge-generics replace warn-override-core warn last)
	scheme@(guile-user)> (use-modules (mg-3))
	(letstry)
	...
	WARNING: (mg-3): `dialog' imported from both (mg-1) and (mg-2)
	ERROR: In procedure scm-error:
	ERROR: No applicable method for #<<accessor> dialog (1)> in call (dialog #<<widget-a> 94c4910>)



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-09 15:08               ` David Pirotte
@ 2011-07-11 15:49                 ` Andy Wingo
  2011-07-12  1:25                   ` David Pirotte
  2011-08-03 12:28                   ` David Pirotte
  0 siblings, 2 replies; 18+ messages in thread
From: Andy Wingo @ 2011-07-11 15:49 UTC (permalink / raw)
  To: David Pirotte; +Cc: bug-guile, Ludovic Courtès

On Sat 09 Jul 2011 17:08, David Pirotte <david@altosw.be> writes:

> Hi Andy,
>
>> >>   (default-duplicate-binding-handler
>> >>     '(merge-generics replace warn-override-core warn last))
>> >
>> > This is not 'so important' anymore, but for bug tracking purposes, please note
>> > that adding the above in my init.scm file and commenting the #:duplicates (...)
>> > expression leads to the known error:
>
>> Git pull, please :).  You still don't have some recent fixes.
>
> I am pulling :) Do you mean I have to checkout an unstable? [if yes, please tell me
> what branch/version, I am git [very] 'limited' @ the moment :)

Ah, funny, I thought the version would always correspond to what you
had.  But that is not the case:

  wingo@badger:~/src/guile$ git describe
  v2.0.2-7-gae88d9b
  wingo@badger:~/src/guile$ meta/guile
  GNU Guile 2.0.2.4-c1e3e

I guess what I meant was that you needed a newer Guile, but you might
have a new enough one.  Hmm.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-11 15:49                 ` Andy Wingo
@ 2011-07-12  1:25                   ` David Pirotte
  2011-08-18 11:01                     ` Andy Wingo
  2011-08-03 12:28                   ` David Pirotte
  1 sibling, 1 reply; 18+ messages in thread
From: David Pirotte @ 2011-07-12  1:25 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile, Ludovic Courtès

[-- Attachment #1: Type: text/plain, Size: 3016 bytes --]

Hi Andy,

> Ah, funny, I thought the version would always correspond to what you
> had.  But that is not the case:
> 
>   wingo@badger:~/src/guile$ git describe
>   v2.0.2-7-gae88d9b
>   wingo@badger:~/src/guile$ meta/guile
>   GNU Guile 2.0.2.4-c1e3e
> 
> I guess what I meant was that you needed a newer Guile, but you might
> have a new enough one.  Hmm.

I think I did put a finger on some deeper problem! At first, as it is still is not
working here in a more 'complex environment', I did build a slightly modified
version using gtk but not yet 'realizing' the widgets [attached].

It seemed it worked on one machine but not on the other. Suspecting a 'strange'
collateral effect on whether I did or not put (default-duplicate-binding-handler
'(merge-generics replace warn-override-core warn last)) in my init.scm file, using
or not the #:duplicates ... in mg-wgtk-3.scm and, couple of hours later, almost ready
to knock my head on the wall while just trying to simply produce a reproducable
'something' for you. :), than I spotted it!

	it only works the first time! then guile compiles and caches the .go files
	but does something 'different' in memory [I guess]

	the second time, it load the .go and fails to dispatch

Here is a track on the 'latest' version [by number at least]:

In a terminal:
[I first remove the *.go concerned files [the location will depend off course ...]

david@rascar:~/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests 6 $ rm -f *.go
david@rascar:~/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests 7 $ ll
total 0

In my emacs:

david@rascar:~ 13 $ guile-gnome-2 
GNU Guile 2.0.2.7-ae88d
...
scheme@(guile-user)> (use-modules (mg-wgtk-3))
(letstry)

;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /usr/local/share/guile/alto/2.0/tests/mg-wgtk-3.scm
;;; compiling /usr/local/share/guile/alto/2.0/tests/mg-wgtk-1.scm
;;; compiled /usr/alto/staff/david/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests/mg-wgtk-1.scm.go
;;; compiling /usr/local/share/guile/alto/2.0/tests/mg-wgtk-2.scm
;;; compiled /usr/alto/staff/david/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests/mg-wgtk-2.scm.go
WARNING: (mg-wgtk-3): `dialog' imported from both (mg-wgtk-1) and (mg-wgtk-2)
;;; compiled /usr/alto/staff/david/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests/mg-wgtk-3.scm.go
Top level dialog: #<<gtk-window> 9ab4d10>
Printing dialog: #<<gtk-message-dialog> 9ab4600>
$1 = #t
scheme@(guile-user)> ,q
david@rascar:~ 14 $ guile-gnome-2 
GNU Guile 2.0.2.7-ae88d
...
scheme@(guile-user)> (use-modules (mg-wgtk-3))
(letstry)

WARNING: (mg-wgtk-3): `dialog' imported from both (mg-wgtk-1) and (mg-wgtk-2)
ERROR: In procedure scm-error:
ERROR: No applicable method for #<<accessor> dialog (1)> in call (dialog #<<tl-widget> a1ccba0>)

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.

[-- Attachment #2: mg-wgtk-1.scm --]
[-- Type: text/x-scheme, Size: 430 bytes --]


(define-module (mg-wgtk-1)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :export (<tl-widget>
	    dialog

	    make-tl-widget
	    ))


(define-class <tl-widget> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value #f)
  )

(define (make-tl-widget)
  (let ((tl-widget (make <tl-widget>
		     :dialog (make <gtk-window>
			       :type 'toplevel
			       ))))
    tl-widget))


[-- Attachment #3: mg-wgtk-2.scm --]
[-- Type: text/x-scheme, Size: 403 bytes --]


(define-module (mg-wgtk-2)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :export (<p-widget>
	    dialog

	    make-p-widget
	    ))


(define-class <p-widget> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value #f)
  )

(define (make-p-widget)
  (let ((p-widget (make <p-widget>
		    :dialog (make <gtk-message-dialog>
			      ))))
    p-widget))


[-- Attachment #4: mg-wgtk-3.scm --]
[-- Type: text/x-scheme, Size: 640 bytes --]


(define-module (mg-wgtk-3)
  :use-module (ice-9 format)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :use-module (mg-wgtk-1)
  :use-module (mg-wgtk-2)

  :duplicates (merge-generics 
	       replace
	       warn-override-core
	       warn
	       last)

  :export (letstry
	   ))


(define (letstry)
  (let ((tl (make-tl-widget))
	(p (make-p-widget)))
    (format #t "Top level dialog: ~S~%" (dialog tl))
    (format #t "Printing dialog: ~S~%" (dialog p))))


#!

(use-modules (macros push))
(push! "/usr/local/share/guile/alto/2.0/tests"
       %load-path)

(use-modules (mg-wgtk-3))
(letstry)

!#

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-11 15:49                 ` Andy Wingo
  2011-07-12  1:25                   ` David Pirotte
@ 2011-08-03 12:28                   ` David Pirotte
  1 sibling, 0 replies; 18+ messages in thread
From: David Pirotte @ 2011-08-03 12:28 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile, Ludovic Courtès

Hi Andy,
Ludovic,

Any news about the following problem I reported ? I am kindly pinging you both, as
it is very difficult to [smoothly] work with goops until this problem is solved - unless, on
purpose, you do not give identical names to any slot pertaining to different classes,
but this is kind of a 'nightmare' in a 'real world'.

Thanks,
David

;; --

> Ah, funny, I thought the version would always correspond to what you
> had.  But that is not the case:
> 
>   wingo@badger:~/src/guile$ git describe
>   v2.0.2-7-gae88d9b
>   wingo@badger:~/src/guile$ meta/guile
>   GNU Guile 2.0.2.4-c1e3e
> 
> I guess what I meant was that you needed a newer Guile, but you might
> have a new enough one.  Hmm.

I think I did put a finger on some deeper problem! At first, as it is still is not
working here in a more 'complex environment', I did build a slightly modified
version using gtk but not yet 'realizing' the widgets [attached].

It seemed it worked on one machine but not on the other. Suspecting a 'strange'
collateral effect on whether I did or not put (default-duplicate-binding-handler
'(merge-generics replace warn-override-core warn last)) in my init.scm file, using
or not the #:duplicates ... in mg-wgtk-3.scm and, couple of hours later, almost ready
to knock my head on the wall while just trying to simply produce a reproducable
'something' for you. :), than I spotted it!

	it only works the first time! then guile compiles and caches the .go files
	but does something 'different' in memory [I guess]

	the second time, it load the .go and fails to dispatch

Here is a track on the 'latest' version [by number at least]:

In a terminal:
[I first remove the *.go concerned files [the location will depend off course ...]

david@rascar:~/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests 6 $ rm -f *.go
david@rascar:~/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests 7 $ ll
total 0

In my emacs:

david@rascar:~ 13 $ guile-gnome-2 
GNU Guile 2.0.2.7-ae88d
...
scheme@(guile-user)> (use-modules (mg-wgtk-3))
(letstry)

;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /usr/local/share/guile/alto/2.0/tests/mg-wgtk-3.scm
;;; compiling /usr/local/share/guile/alto/2.0/tests/mg-wgtk-1.scm
;;; compiled /usr/alto/staff/david/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests/mg-wgtk-1.scm.go
;;; compiling /usr/local/share/guile/alto/2.0/tests/mg-wgtk-2.scm
;;; compiled /usr/alto/staff/david/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests/mg-wgtk-2.scm.go
WARNING: (mg-wgtk-3): `dialog' imported from both (mg-wgtk-1) and (mg-wgtk-2)
;;; compiled /usr/alto/staff/david/.cache/guile/ccache/2.0-LE-4-2.0/usr/local/share/guile/alto/2.0/tests/mg-wgtk-3.scm.go
Top level dialog: #<<gtk-window> 9ab4d10>
Printing dialog: #<<gtk-message-dialog> 9ab4600>
$1 = #t
scheme@(guile-user)> ,q
david@rascar:~ 14 $ guile-gnome-2 
GNU Guile 2.0.2.7-ae88d
...
scheme@(guile-user)> (use-modules (mg-wgtk-3))
(letstry)

WARNING: (mg-wgtk-3): `dialog' imported from both (mg-wgtk-1) and (mg-wgtk-2)
ERROR: In procedure scm-error:
ERROR: No applicable method for #<<accessor> dialog (1)> in call (dialog #<<tl-widget> a1ccba0>)

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-07-12  1:25                   ` David Pirotte
@ 2011-08-18 11:01                     ` Andy Wingo
  2011-08-19  5:40                       ` David Pirotte
  0 siblings, 1 reply; 18+ messages in thread
From: Andy Wingo @ 2011-08-18 11:01 UTC (permalink / raw)
  To: David Pirotte; +Cc: bug-guile, Ludovic Courtès

Hi David,

I fixed it!

On Tue 12 Jul 2011 03:25, David Pirotte <david@altosw.be> writes:

> it only works the first time!

This was the clue.  Here's the commit log:

    fix order of importing modules and resolving duplicates handlers
    
    * module/ice-9/boot-9.scm (define-module*): Resolve duplicates handlers
      only after importing modules.  Fixes a bug in which a module with
      #:use-module (oop goops) but whose merge-generics handler got resolved
      to noop instead of the real merge-generics handler.  I can't think of
      an easy way to test this, though.
    
      Thanks to David Pirotte for the report!

It worked the first time because the define-module form got evaluated
twice: once during expand and once during eval (or load, for the
compiled case).  So the second evaluation it resolved merge-generics
correctly.

But, when loading from .go, there is no expansion, so there was just the
one define-module* invocation, which exposed this ordering issue.

Unfortunately this is very difficult to put into a test suite because it
relies on Goops *not* being loaded when define-module* is called.
Perhaps someone will come up with a nice test case, perhaps involving
a direct call to define-module* from a standalone test case.

Sorry the fix took so long, and thanks for the debugging.  Cheers!

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-08-18 11:01                     ` Andy Wingo
@ 2011-08-19  5:40                       ` David Pirotte
  2011-08-29 17:05                         ` David Pirotte
  0 siblings, 1 reply; 18+ messages in thread
From: David Pirotte @ 2011-08-19  5:40 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile, Ludovic Courtès

Hi Andy,

Le Thu, 18 Aug 2011 13:01:34 +0200,
Andy Wingo <wingo@pobox.com> a écrit :

> Hi David,
> 
> I fixed it!

Thank you very much! The examples I sent earlier now all work, but I still have a
problem when running my app [the app is working perfectly if I name differently all
exported slot accessors, which I did while you were debugging]: I am trying to
figure out what is happening and hope to get back with a better 'figure' but here is
the backtrace I get [below].

	note that I did double check [in the gtk-repl before to click the 'print
	button' which triggers the error] that (default-duplicate-binding-handler)
	is effectively 'global' [in my init.scm] and returns what 'it should':
		(merge-generics replace warn-override-core warn last)

It is strange because the ERROR mentions No applicable method for #<<generic> show
(2)> in call (show #<procedure a279930 at oop/goops/dispatch.scm:196:4 args>)

     show is the gtk function of course, and the argument I pass should be the result of
     the following code extract [of a module which uses many others, 2 of which both
     export dialog]:

	...
	(define (kp/select-gui tl-widget)
	  (let* ((kp/widget (kp/make-dialog (dialog tl-widget) (glade-file tl-widget))) 
		   (widget (dialog kp/widget)))
	    (show widget)
	...

so as if (dialog kp/widget) returned a procedure ? As i said i will try to or debug
or better inform you, but if you have an idea, let me know...

Cheers,
David

;; -- 

scheme@(guile-user) [1]> Backtrace:
In unknown file:
   ?: 19 [scm-error goops-error #f ...]
In ice-9/boot-9.scm:
 115: 18 [#<procedure a5de5c8 at ice-9/boot-9.scm:110:6 (thrown-k . args)> goops-error ...]
In ice-9/r4rs.scm:
 174: 17 [with-input-from-port #<variable 9f15ad0 value: #<input: soft 9c20e10>> ...]
 178: 16 [with-output-to-port #<variable 9f15940 value: #<output: soft 9c20690>> ...]
 182: 15 [with-error-to-port #<variable 9f15780 value: #<output: soft 9c20690>> ...]
In system/repl/repl.scm:
 160: 14 [run-repl #<<repl> language: # options: # tm-stats: # gc-stats: # debug: #>]
In ice-9/boot-9.scm:
 170: 13 [catch #t #<procedure a24a650 at system/repl/repl.scm:115:4 ()> ...]
In ice-9/r4rs.scm:
 174: 12 [with-input-from-port #<variable 9b319f0 value: #<input: soft 9c20e10>> ...]
In system/repl/repl.scm:
  88: 11 [#<procedure a279d50 at system/repl/repl.scm:87:6 ()>]
 213: 10 [flush-leading-whitespace]
In unknown file:
   ?: 9 [peek-char #<undefined>]
In ice-9/buffered-input.scm:
  73: 8 [get-character]
 104: 7 [#<procedure 9d42400 at ice-9/buffered-input.scm:103:28 (continuation?)> #t]
In gnome/gtk/graphical-repl.scm:
 269: 6 [#<procedure a1218a0 at gnome/gtk/graphical-repl.scm:260:16 (continuation?)> #t]
In unknown file:
   ?: 5 [%gw:dynamic-procedure #<gw:wcp <g-main-loop> 0xa7e7f28>]
In ice-9/boot-9.scm:
 170: 4 [catch #t #<catch-closure a27be10> ...]
In unknown file:
   ?: 3 [catch-closure]
In kise/print.scm:
  56: 2 [kp/select-gui #<<kise/tl-widget> 9ecae00>]
In oop/goops/dispatch.scm:
 231: 1 [cache-miss # #]
In unknown file:
   ?: 0 [scm-error goops-error #f ...]

ERROR: In procedure scm-error:
ERROR: No applicable method for #<<generic> show (2)> in call (show #<procedure a279930 at oop/goops/dispatch.scm:196:4 args>)




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-08-19  5:40                       ` David Pirotte
@ 2011-08-29 17:05                         ` David Pirotte
  2011-08-30  2:56                           ` David Pirotte
  2011-09-02 11:26                           ` Andy Wingo
  0 siblings, 2 replies; 18+ messages in thread
From: David Pirotte @ 2011-08-29 17:05 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile, Ludovic Courtès

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

Hi Andy,
Ludovic,

> > I fixed it!
> 
> Thank you very much! The examples I sent earlier now all work, but I still have a
> problem ...

I finally could reproduce the problem and wrote an example you can run 'in the cafe
without internet' :) [hopefully] 

	in addition to the comments here below, please note that these examples
	further differs from previous 'versions' I sent in the passed in the sense
	that they now also use (gnome glade)

If you drop the attached somewhere in your %load-path, then you can try the
following 2 tests, one which [here] produces a segfault and the other which
works fine. The only 'important' difference between these 2 tests is expressed by
diff mg-wgtk-0 mg-wgtk-1:

	mg-wgtk-0 defines and export an additional slot which is named glade-file
	[which is then used by mg-wgtk-3 ...]

This should or crash guile or produce an error [the behavior of guile itself is not
systematic [here], but it always 'fails':

	mg-wgtk-3	uses 	mg-wgtk-0
						mg-wgtk-2

	guile-gnome-2
	(use-modules (mg-wgtk-3))
	(letstry)
	->	Top level dialog: #<<gtk-window> a2bbbc0>
		Printing dialog: Segmentation fault


This will work fine:

	mg-wgtk-4	uses 	mg-wgtk-1
						mg-wgtk-2
	guile-gnome-2
	(use-modules (mg-wgtk-4))
	(letstry)
	->	Top level dialog: #<<gtk-window> 8b86c30>
		Printing dialog: #<<gtk-dialog> 8b89110>


Many thanks,
David



[-- Attachment #2: mg-wgtk-0.scm --]
[-- Type: text/x-scheme, Size: 623 bytes --]


(define-module (mg-wgtk-0)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<tl-widget>
	   glade-file
	   dialog
	   
	   make-tl-widget
	   ))


(define-class <tl-widget> ()
  (glade-file :accessor glade-file :init-keyword :glade-file :init-value #f)
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-tl-widget glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kise"))
	 (tl-widget (make <tl-widget>
		      :glade-file glade-f
		      ;; :xml-code xmlc
		      :dialog (get-widget xmlc "kise"))))
    tl-widget))


[-- Attachment #3: mg-wgtk-1.scm --]
[-- Type: text/x-scheme, Size: 477 bytes --]


(define-module (mg-wgtk-1)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<tl-widget>
	   dialog
	   
	   make-tl-widget
	   ))


(define-class <tl-widget> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-tl-widget glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kise"))
	 (tl-widget (make <tl-widget>
		      :dialog (get-widget xmlc "kise"))))
    tl-widget))


[-- Attachment #4: mg-wgtk-2.scm --]
[-- Type: text/x-scheme, Size: 584 bytes --]


(define-module (mg-wgtk-2)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<p-widget>
	    dialog

	    make-p-widget
	    ))


(define-class <p-widget> ()
  ;; (xml-code :accessor xml-code :init-keyword :xml-code :init-value #f)
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-p-widget parent glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kp/dialog"))
	 (p-widget (make <p-widget>
		     ;; :xml-code xmlc
		     :dialog (get-widget xmlc "kp/dialog"))))
    p-widget))


[-- Attachment #5: mg-wgtk-3.scm --]
[-- Type: text/x-scheme, Size: 960 bytes --]


(define-module (mg-wgtk-3)
  :use-module (ice-9 format)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :use-module (mg-wgtk-0)
  :use-module (mg-wgtk-2)

  :duplicates (merge-generics 
	       replace
	       warn-override-core
	       warn
	       last)

  :export (letstry
	   ))


(define (letstry)
  (let* ((tl (make-tl-widget "/usr/alto/projects/kise/glade/kise.glade"))
	 (p (make-p-widget (dialog tl) (glade-file tl))))
    (format #t "Top level dialog: ~S~%" (dialog tl))
    (format #t "Printing dialog: ~S~%" (dialog p))))


#!

(use-modules (macros push))
(push! "/usr/local/share/guile/alto/2.0/tests"
       %load-path)

(use-modules (mg-wgtk-3))
(letstry)


;;;
;;; 2. using glade in mg-gtk-2 as well
;;;

(use-modules (mg-wgtk-3))
,m (mg-wgtk-3)

(define tl (make-tl-widget "/usr/alto/projects/kise/glade/kise.glade"))
(define p (make-p-widget (dialog tl)
			 (glade-file tl)))
(dialog tl)
(dialog p)


!#

[-- Attachment #6: mg-wgtk-4.scm --]
[-- Type: text/x-scheme, Size: 985 bytes --]


(define-module (mg-wgtk-4)
  :use-module (ice-9 format)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :use-module (mg-wgtk-1)
  :use-module (mg-wgtk-2)

  :duplicates (merge-generics 
	       replace
	       warn-override-core
	       warn
	       last)

  :export (letstry
	   ))


(define (letstry)
  (let* ((tl (make-tl-widget "/usr/alto/projects/kise/glade/kise.glade"))
	 (p (make-p-widget (dialog tl)
			   "/usr/alto/projects/kise/glade/kise.glade")))
    (format #t "Top level dialog: ~S~%" (dialog tl))
    (format #t "Printing dialog: ~S~%" (dialog p))))


#!

(use-modules (macros push))
(push! "/usr/local/share/guile/alto/2.0/tests"
       %load-path)

(use-modules (mg-wgtk-4))
(letstry)


;;;
;;;
;;;

(use-modules (mg-wgtk-4))
,m (mg-wgtk-4)

(define tl (make-tl-widget "/usr/alto/projects/kise/glade/kise.glade"))
(define p (make-p-widget (dialog tl)
			 "/usr/alto/projects/kise/glade/kise.glade"))
(dialog tl)
(dialog p)


!#

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-08-29 17:05                         ` David Pirotte
@ 2011-08-30  2:56                           ` David Pirotte
  2011-09-02 11:26                           ` Andy Wingo
  1 sibling, 0 replies; 18+ messages in thread
From: David Pirotte @ 2011-08-30  2:56 UTC (permalink / raw)
  To: David Pirotte; +Cc: bug-guile, Ludovic Courtès

[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]

Hi again,

	I reply to myself too :)

I realized while I was in a cafe without internet :) that I forgot to attach a
[simplified] glade file. I took this 'opportunity' to edit both mg-wgtk-3 and
mg-wgtk-4 so that there is one global to change to perform in these 2 files ...

So I decided to attach the all example set again, and the glade file, to facilitate
the work of who ever would like to try and debug ... 

	->	'you' may forget the previous email, use the attachments of this
		one and the text below

Sorry about this,
Cheers,
David

;; --

Le Mon, 29 Aug 2011 14:05:18 -0300,
David Pirotte <david@altosw.be> a écrit :

> Hi Andy,
> Ludovic,
> 
> > > I fixed it!
> > 
> > Thank you very much! The examples I sent earlier now all work, but I still have a
> > problem ...
> 
> I finally could reproduce the problem and wrote an example you can run 'in the cafe
> without internet' :) [hopefully] 
> 
> 	in addition to the comments here below, please note that these examples
> 	further differs from previous 'versions' I sent in the passed in the sense
> 	that they now also use (gnome glade)
> 
> If you drop the attached somewhere in your %load-path, then you can try the
> following 2 tests, one which [here] produces a segfault and the other which
> works fine. The only 'important' difference between these 2 tests is expressed by
> diff mg-wgtk-0 mg-wgtk-1:
> 
> 	mg-wgtk-0 defines and export an additional slot which is named glade-file
> 	[which is then used by mg-wgtk-3 ...]
> 
> This should or crash guile or produce an error [the behavior of guile itself is not
> systematic [here], but it always 'fails':
> 
> 	mg-wgtk-3	uses 	mg-wgtk-0
> 						mg-wgtk-2
> 
> 	guile-gnome-2
> 	(use-modules (mg-wgtk-3))
> 	(letstry)
> 	->	Top level dialog: #<<gtk-window> a2bbbc0>
> 		Printing dialog: Segmentation fault
> 
> 
> This will work fine:
> 
> 	mg-wgtk-4	uses 	mg-wgtk-1
> 						mg-wgtk-2
> 	guile-gnome-2
> 	(use-modules (mg-wgtk-4))
> 	(letstry)
> 	->	Top level dialog: #<<gtk-window> 8b86c30>
> 		Printing dialog: #<<gtk-dialog> 8b89110>
> 
> 
> Many thanks,
> David
> 
> 

[-- Attachment #2: mg-wgtk-0.scm --]
[-- Type: text/x-scheme, Size: 623 bytes --]


(define-module (mg-wgtk-0)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<tl-widget>
	   glade-file
	   dialog
	   
	   make-tl-widget
	   ))


(define-class <tl-widget> ()
  (glade-file :accessor glade-file :init-keyword :glade-file :init-value #f)
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-tl-widget glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kise"))
	 (tl-widget (make <tl-widget>
		      :glade-file glade-f
		      ;; :xml-code xmlc
		      :dialog (get-widget xmlc "kise"))))
    tl-widget))


[-- Attachment #3: mg-wgtk-1.scm --]
[-- Type: text/x-scheme, Size: 477 bytes --]


(define-module (mg-wgtk-1)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<tl-widget>
	   dialog
	   
	   make-tl-widget
	   ))


(define-class <tl-widget> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-tl-widget glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kise"))
	 (tl-widget (make <tl-widget>
		      :dialog (get-widget xmlc "kise"))))
    tl-widget))


[-- Attachment #4: mg-wgtk-2.scm --]
[-- Type: text/x-scheme, Size: 584 bytes --]


(define-module (mg-wgtk-2)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<p-widget>
	    dialog

	    make-p-widget
	    ))


(define-class <p-widget> ()
  ;; (xml-code :accessor xml-code :init-keyword :xml-code :init-value #f)
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-p-widget parent glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kp/dialog"))
	 (p-widget (make <p-widget>
		     ;; :xml-code xmlc
		     :dialog (get-widget xmlc "kp/dialog"))))
    p-widget))


[-- Attachment #5: mg-wgtk-3.scm --]
[-- Type: text/x-scheme, Size: 1073 bytes --]


(define-module (mg-wgtk-3)
  :use-module (ice-9 format)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :use-module (mg-wgtk-0)
  :use-module (mg-wgtk-2)

  :duplicates (merge-generics 
	       replace
	       warn-override-core
	       warn
	       last)

  :export (letstry
	   ))

;; you'll have to edit this before to run, according
;; to where you will have saved  'kise.exa.glade'
(define *glade-file* "/usr/alto/projects/kise/glade/kise.exa.glade")


(define (letstry)
  (let* ((tl (make-tl-widget *glade-file*))
	 (p (make-p-widget (dialog tl) (glade-file tl))))
    (format #t "Top level dialog: ~S~%" (dialog tl))
    (format #t "Printing dialog: ~S~%" (dialog p))))


#!

(use-modules (macros push))
(push! "/usr/local/share/guile/alto/2.0/tests"
       %load-path)

(use-modules (mg-wgtk-3))
(letstry)


;;;
;;; 2. using glade in mg-gtk-2 as well
;;;

(use-modules (mg-wgtk-3))
,m (mg-wgtk-3)

(define tl (make-tl-widget *glade-file*))
(define p (make-p-widget (dialog tl)
			 (glade-file tl)))
(dialog tl)
(dialog p)


!#

[-- Attachment #6: mg-wgtk-4.scm --]
[-- Type: text/x-scheme, Size: 1039 bytes --]


(define-module (mg-wgtk-4)
  :use-module (ice-9 format)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :use-module (mg-wgtk-1)
  :use-module (mg-wgtk-2)

  :duplicates (merge-generics 
	       replace
	       warn-override-core
	       warn
	       last)

  :export (letstry
	   ))

;; you'll have to edit this before to run, according
;; to where you will have saved  'kise.exa.glade'
(define *glade-file* "/usr/alto/projects/kise/glade/kise.exa.glade")


(define (letstry)
  (let* ((tl (make-tl-widget *glade-file*))
	 (p (make-p-widget (dialog tl)
			   *glade-file*)))
    (format #t "Top level dialog: ~S~%" (dialog tl))
    (format #t "Printing dialog: ~S~%" (dialog p))))


#!

(use-modules (macros push))
(push! "/usr/local/share/guile/alto/2.0/tests"
       %load-path)

(use-modules (mg-wgtk-4))
(letstry)


;;;
;;;
;;;

(use-modules (mg-wgtk-4))
,m (mg-wgtk-4)

(define tl (make-tl-widget *glade-file*))
(define p (make-p-widget (dialog tl)
			 *glade-file*))

(dialog tl)
(dialog p)


!#

[-- Attachment #7: kise.exa.glade --]
[-- Type: application/x-glade, Size: 4796 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-08-29 17:05                         ` David Pirotte
  2011-08-30  2:56                           ` David Pirotte
@ 2011-09-02 11:26                           ` Andy Wingo
  2011-09-06 15:41                             ` David Pirotte
  1 sibling, 1 reply; 18+ messages in thread
From: Andy Wingo @ 2011-09-02 11:26 UTC (permalink / raw)
  To: David Pirotte; +Cc: bug-guile, Ludovic Courtès

Hi David,

On Mon 29 Aug 2011 19:05, David Pirotte <david@altosw.be> writes:

> I finally could reproduce the problem and wrote an example you can run 'in the cafe
> without internet' :) [hopefully] 

Well.  This was indeed an amusing issue :)

I am indeed sitting in the café, and so thank you :)  However right now
I trust Guile more than I trust Guile-GNOME, so an more minimal
case is even better :)  Like this:

a.scm:

    (define-module (a)
      #:use-module (oop goops)
      #:export (<a> foo bar make-a))

    (define-class <a> ()
      (foo #:accessor foo #:init-keyword #:foo #:init-value #f)
      (bar #:accessor bar #:init-keyword #:bar #:init-value #f))

    (define (make-a)
      (make <a> #:foo "qux" #:bar "a"))

b.scm:

    (define-module (b)
      #:use-module (oop goops)
      #:export (<b> bar make-b))

    (define-class <b> ()
      (bar #:accessor bar #:init-keyword #:bar #:init-value #f))

    (define (make-b)
      (make <b> #:bar "b"))

test.scm:

    (define-module (test)
      #:use-module (ice-9 format)
      #:use-module (oop goops)
      #:use-module (a)
      #:use-module (b)

      #:duplicates (merge-generics 
                    replace
                    warn-override-core
                    warn
                    last)

      #:export (run-test))

    (define (run-test)
      (let* ((a (make-a))
    	 (b (make-b)))
        (format #t "(bar a): ~S~%" (bar a))
        (format #t "(bar b): ~S~%" (bar b))))

The ultimate issue was a cache coherency problem.  The set of methods of
an extended (merged) generic depends on the sets of methods of the
extendees.  Some aspects about the method set are cached.  This cache
was not being managed properly.  I believe that I have fixed it in
Guile.

Thanks for the report,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
  2011-09-02 11:26                           ` Andy Wingo
@ 2011-09-06 15:41                             ` David Pirotte
  0 siblings, 0 replies; 18+ messages in thread
From: David Pirotte @ 2011-09-06 15:41 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile, Ludovic Courtès

Hi Andy,

> ... Well.  This was indeed an amusing issue :)

> I am indeed sitting in the café, and so thank you :)  However right now
> I trust Guile more than I trust Guile-GNOME, so an more minimal
> case is even better :)  Like this:

Yes, of course: it took me a while to understand what could be the cause of the bug,
and all attempts until reaching the sample I sent, were made upon these small gtk
pieces of code. Then I thought, too late, that I should have tried also using guile
only before to send ...

> a.scm:
> ...

Thanks for the example, understood, i'll do my best in the future. I realize I
should also learn not to write example code that depends on what is in my init.scm
[such as (read-set! keywords 'prefix), (ice-9 format) ...].

> ... I believe that I have fixed it in Guile.

Many thanks. I believe it is fixed too.

> Thanks for the report,

Welcome,

Cheers,
David





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-09-06 15:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-05 21:32 module system / (oop goops) / :duplicates (merge-generics) / bug? David Pirotte
2011-07-06 16:17 ` Ludovic Courtès
2011-07-06 19:22   ` David Pirotte
2011-07-07 11:37     ` Andy Wingo
2011-07-07 16:26       ` David Pirotte
2011-07-07 20:59         ` Andy Wingo
2011-07-08 17:05           ` David Pirotte
2011-07-09 10:02             ` Andy Wingo
2011-07-09 15:08               ` David Pirotte
2011-07-11 15:49                 ` Andy Wingo
2011-07-12  1:25                   ` David Pirotte
2011-08-18 11:01                     ` Andy Wingo
2011-08-19  5:40                       ` David Pirotte
2011-08-29 17:05                         ` David Pirotte
2011-08-30  2:56                           ` David Pirotte
2011-09-02 11:26                           ` Andy Wingo
2011-09-06 15:41                             ` David Pirotte
2011-08-03 12:28                   ` David Pirotte

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).