unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: David Pirotte <david@altosw.be>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: goops - guile-clutter unexpected bug while using #:virtual slot allocation for a <clutter-actor> subclass
Date: Wed, 4 Feb 2015 14:12:54 -0200	[thread overview]
Message-ID: <20150204141254.44d1bf85@capac> (raw)
In-Reply-To: <87zj94c5rv.fsf@pobox.com>

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

Hello Andy,

>     $ /opt/guile-1.8/bin/guile
>     guile> (use-modules (oop goops))
>     guile> (define-class <a> ()
>     ...    (width #:accessor width #:init-keyword #:width #:init-value 0))
>     guile> (define-class <b> (<a>))
>     guile> (define b (make <b>))
>     guile> (width b)
>     0
>     guile> (set! (width b) 10)
>     guile> (width b)
>     10
>     guile> (define-method ((setter width) (self <b>) width) (next-method))
>     guile> (set! (width b) 10)
> 
>     Backtrace:
>     In current input:
>       10: 0* [setter:width #<<b> 7f795ed527e0> 10]
>        ?: 1  (let* ((next-method (goops:make-next-method self width)))
> (next-method))
> 
>     <unnamed port>: In expression (let* (#) (next-method)):
>     <unnamed port>: No next method when calling #<<generic> setter:width (2)>
>     with arguments (#<<b> 7f795ed527e0> 10)
>     ABORT: (goops-error)

With respect to the above example(*), I _do_ get the expected result here, using
the latest stable-2.0:

	please leave it as it is, it _is_ correct: I'm writing back because you
	pretend it should not work, I got confused...

	but it does, as it should, thanks god, the opposite would be a real disaster

Cheers,
David

(*)	not to be confused with the setter inheritance bug I mentioned, still is
	present in the latest stable, so I [just[ reported it.

--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>))
(define-method ((setter !width) (self <b>) width)
  (next-method)
  ;; here comes 'extra' work <b> instances must 'run'
  (pk "this is <b> !width setter method, hello!")
  (!width self))
--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)> 
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)

;;; ("this is <a> !width setter method, hello!")

;;; ("this is <b> !width setter method, hello!")
$2 = 20
scheme@(guile-user)> 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      parent reply	other threads:[~2015-02-04 16:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 19:46 goops - guile-clutter unexpected bug while using #:virtual slot allocation for a <clutter-actor> subclass David Pirotte
2014-12-19 23:42 ` Panicz Maciej Godek
2014-12-20  6:16   ` David Pirotte
2015-01-26 21:35 ` Andy Wingo
2015-01-27  1:00   ` David Pirotte
2015-01-27  8:29     ` Andy Wingo
2015-01-27 19:11       ` David Pirotte
2015-01-27 19:35         ` David Pirotte
2015-01-27 20:44         ` Andy Wingo
2015-01-28  3:05           ` David Pirotte
2015-01-28  3:36             ` David Pirotte
2015-01-28 12:57             ` Andy Wingo
2015-01-28 19:24               ` David Pirotte
2015-01-30 13:50           ` David Pirotte
2015-02-06 13:33             ` Andy Wingo
2015-02-06 17:09               ` David Pirotte
2015-02-06 17:49                 ` Andy Wingo
2015-02-07  0:06                   ` David Pirotte
2015-02-07 15:37                     ` Andy Wingo
2015-02-07 17:13                       ` David Pirotte
2015-02-07 16:08                     ` David Pirotte
2015-02-04 16:12           ` David Pirotte [this message]

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=20150204141254.44d1bf85@capac \
    --to=david@altosw.be \
    --cc=guile-devel@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).