guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: goops - guile-clutter unexpected bug while using #:virtual slot allo


From: David Pirotte
Subject: Re: goops - guile-clutter unexpected bug while using #:virtual slot allocation for a <clutter-actor> subclass
Date: Wed, 28 Jan 2015 01:05:24 -0200

Hello Andy,

        we should change the subject or start a new thread, maybe

> Are you certain?  What git revision are you using?  I don't think the
> test should "work" with the current stable-2.0 or master, or 1.8 for
> that matter.

Oh no, it's not working as it should, too bad:  this time I cleared my cache
I did not take care of that carefully enough I guess... anyway, the good news is
that:

        I think we still are not talking about _exactly_ the same think here and
        hope that when we do, you will agree;

        Indeed please note that in the code of my previous message, the define
        setter on the <b> class _is_ commented:  i am sorry if it induced you in
        some sort of misunderstanding, but that line should _not_ even exist 
(that
        was a trick to circumvent till now);

        If that line does not exist,  then using the setter on a <b> instance 
must
        call/execute the code of the setter defined at superclass level, <a> in 
our
        case.  by no mean, it should internally/hiddenly redefine my beautiful
        setter :), in my back, not without talking to me first anyway :)

So, here is the code, without the setter being redefined...:

;; module a.scm starts here
(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 and calling lower
  ;; level clutter internals, such as the <clutter-actor> layout...
  (pk "this is <a> !width setter method, hello!")
  (slot-set! self 'width width))
;; module ends here

;; module b.scm starts here
(define-module (b)
  #:use-module (oop goops)
  #:use-module (a)
  #:export (<b>)

  #:re-export (!width))

(define-class <b> (<a>))
;; module ends here

And here is what I get, which is not correct:  since I did not redefine anything
at <b> level, the slot and 'associated functionality', the setter in this case, 
must
be 'fully' inherited: it is the setter I define on <a> that must be called when
being used on any instances, all <a> and <b> instances

        [ this  time I left the guile version as well), please double check

address@hidden:~/alto/projects/guile-tests/goops 15 $ guile
GNU Guile 2.0.11.113-583a
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)> ,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/next-method-not-called/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/next-method-not-called/a.scm.go
;;; compiling ./a.scm
;;; compiled 
/home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/next-method-not-called/a.scm.go
;;; compiled 
/home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/guile-tests/goops/next-method-not-called/b.scm.go
scheme@(guile-user)> (make <b>)
$1 = #<<b> 1ffcb80>
scheme@(guile-user)> (!width $1)
$2 = 0
scheme@(guile-user)> (set! (!width $1) 20)
$3 = 20
scheme@(guile-user)> 


Cheers,
David

Attachment: pgpl4fcatm7RR.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]