unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: David Pirotte <david@altosw.be>
To: Andy Wingo <wingo@pobox.com>
Cc: bug-guile@gnu.org, "Ludovic Courtès" <ludo@gnu.org>
Subject: Re: module system / (oop goops) / :duplicates (merge-generics) / bug?
Date: Mon, 29 Aug 2011 14:05:18 -0300	[thread overview]
Message-ID: <20110829140518.4ad0c46a@rascar> (raw)
In-Reply-To: <20110819024043.74a4d71e@rascar>

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


!#

  reply	other threads:[~2011-08-29 17:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110829140518.4ad0c46a@rascar \
    --to=david@altosw.be \
    --cc=bug-guile@gnu.org \
    --cc=ludo@gnu.org \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).