GNU bug report logs - #19770
goops - setter inheritance bug - serious

Previous Next

Package: guile;

Reported by: David Pirotte <david <at> altosw.be>

Date: Wed, 4 Feb 2015 15:45:01 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19770 in the body.
You can then email your comments to 19770 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#19770; Package guile. (Wed, 04 Feb 2015 15:45:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Pirotte <david <at> altosw.be>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 04 Feb 2015 15:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David Pirotte <david <at> altosw.be>
To: <bug-guile <at> gnu.org>
Subject: goops - setter inheritance bug - serious
Date: Wed, 4 Feb 2015 13:43:58 -0200
[Message part 1 (text/plain, inline)]
Hello,

	GNU Guile 2.0.11.114-649ec
	goops - setter inheritance bug
	severity - serious

setters are beeing redefined, not inhereted:  this is a serious bug.

Cheers,
David


--8<---------------cut here---------------start------------->8---
(define-module (a)
  #:use-module (oop goops)
  #:export (<a>
	    !width))


(define-class <a> ()
  (width #:accessor !width #:init-keyword #:width #:init-value 0))

(define-method ((setter !width) (self <a>) width)
  ;; here comes complex code, computing earth orbit, captain's age...
  (pk "this is <a> !width setter method, hello!")
  (slot-set! self 'width width))
--8<---------------cut here---------------start------------->8---

--8<---------------cut here---------------start------------->8---
(define-module (b)
  #:use-module (oop goops)
  #:use-module (a)
  #:export (<b>)

  #:re-export (!width))


(define-class <b> (<a>))
--8<---------------cut here---------------start------------->8---

GNU Guile 2.0.11.114-649ec
Copyright (C) 1995-2014 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)> 
scheme@(guile-user)> ,use (oop goops)
scheme@(guile-user)> ,use (b)
;;; note: source file ./b.scm
;;;       newer than compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/setter-inheritance-bug/b.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling ./b.scm
;;; note: source file ./a.scm
;;;       newer than compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/setter-inheritance-bug/a.scm.go
;;; compiling ./a.scm
;;; compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/setter-inheritance-bug/a.scm.go
;;; compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/setter-inheritance-bug/b.scm.go
scheme@(guile-user)> (set! (!width (make <b>)) 20)
$2 = 20
scheme@(guile-user)> 
			   
[Message part 2 (application/pgp-signature, inline)]

Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Thu, 23 Jun 2016 09:12:02 GMT) Full text and rfc822 format available.

Notification sent to David Pirotte <david <at> altosw.be>:
bug acknowledged by developer. (Thu, 23 Jun 2016 09:12:02 GMT) Full text and rfc822 format available.

Message #10 received at 19770-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: David Pirotte <david <at> altosw.be>
Cc: 19770-done <at> debbugs.gnu.org
Subject: Re: bug#19770: goops - setter inheritance bug - serious
Date: Thu, 23 Jun 2016 11:11:21 +0200
Hi David,

Sorry for the long delay.  I think this is not a bug.  The reason is
that you defined !width as an #:accessor.  That means that each concrete
class which has a `width' slot will have its own accessor method
installed on it.  You overrode the method for <a> instances but not for
any other concrete class; e.g. <b> will have its own method.

If you want to run methods in the setter, you need to not define !width
as an accessor and instead rely on your define-method to create !width
as a normal generic.  I.e. remove #:accessor !width from (define-class
a).

Andy

On Wed 04 Feb 2015 16:43, David Pirotte <david <at> altosw.be> writes:

> Hello,
>
> 	GNU Guile 2.0.11.114-649ec
> 	goops - setter inheritance bug
> 	severity - serious
>
> setters are beeing redefined, not inhereted:  this is a serious bug.
>
> Cheers,
> David
>
>
> (define-module (a)
>   #:use-module (oop goops)
>   #:export (<a>
> 	    !width))
>
>
> (define-class <a> ()
>   (width #:accessor !width #:init-keyword #:width #:init-value 0))
>
> (define-method ((setter !width) (self <a>) width)
>   ;; here comes complex code, computing earth orbit, captain's age...
>   (pk "this is <a> !width setter method, hello!")
>   (slot-set! self 'width width))
>
> (define-module (b)
>   #:use-module (oop goops)
>   #:use-module (a)
>   #:export (<b>)
>
>   #:re-export (!width))
>
>
> (define-class <b> (<a>))
>
> GNU Guile 2.0.11.114-649ec
> Copyright (C) 1995-2014 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)> 
> scheme@(guile-user)> ,use (oop goops)
> scheme@(guile-user)> ,use (b)
> ;;; note: source file ./b.scm
> ;;;       newer than compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/setter-inheritance-bug/b.scm.go
> ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
> ;;;       or pass the --no-auto-compile argument to disable.
> ;;; compiling ./b.scm
> ;;; note: source file ./a.scm
> ;;;       newer than compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/setter-inheritance-bug/a.scm.go
> ;;; compiling ./a.scm
> ;;; compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/setter-inheritance-bug/a.scm.go
> ;;; compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/setter-inheritance-bug/b.scm.go
> scheme@(guile-user)> (set! (!width (make <b>)) 20)
> $2 = 20
> scheme@(guile-user)> 
> 			   




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 21 Jul 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 48 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.