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: Andy Wingo
Subject: Re: goops - guile-clutter unexpected bug while using #:virtual slot allocation for a <clutter-actor> subclass
Date: Fri, 06 Feb 2015 18:49:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Hi :)

On Fri 06 Feb 2015 18:09, David Pirotte <address@hidden> writes:

> (2) I have a different answer from my guile version for the second
> part [which I think is the correct answer, maybe you wanted to paste
> some other code [?], don't know.

Part of my mail described buggy Guile 2.0.  Please re-read to be sure,
if you have questions :)

With the stable-2.0 or master branches, the current behavior is:

    scheme@(guile-user)> (use-modules (oop goops))
    scheme@(guile-user)> (define-class <a> ()
    ...   (foo #:getter foo #:init-keyword #:foo))
    scheme@(guile-user)> (define-class <b> (<a>))
    scheme@(guile-user)> (define obj (make <b> #:foo 34))
    scheme@(guile-user)> (define-method (foo (self <b>))
    ...   (pk "ahoy!")
    ...   (next-method))
    scheme@(guile-user)> (pk (foo obj))

    ;;; ("ahoy!")
    ERROR: In procedure scm-error:
    ERROR: No next method when calling #<<generic> foo (2)>
    with arguments (#<<b> 2c207e0>)

    Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
    scheme@(guile-user) [1]> 

> In this case indeed, the only method that exists and is applicable is
> the getter foo that <a> defines and<b> inherits: there is no
> next-method and calling (next-method) would be a user bug, in my
> opinion too.

So, we should be precise with terminology :)  In GOOPS, subclasses do
not inherit accessor methods.  (There was a bug in which they would; I
fixed that.)  Each subclass gets its own accessor method defined, if and
only if it has the corresponding slot, and that method is not inherited.

>>    ;;; ("wat!!!")
>> 
>>    ;;; (42)
>>    $2 = 42
>
> Here I am confused again: given the above, defining foo on <ac> and calling
> (next-method) is not different then the foo on <b>, there is no next-method 
> and I
> get the error as well, maybe you wanted to paste some other code? Here is 
> what I
> get, given the definitions above (*)

Here I was describing buggy Guile 2.0 (hence past tense).

>>  The slot definition protocol in CLOS is different; for example,
>> compute-effective-slot-definition in CLOS logically *combines* slot
>> definitions with the same name.
>
> Is it not what goops does as well? I thought so.

Nope :)  That bit of the protocol was never implemented.  Instead the
semantics are that the slot from the first entry in the CPL is used.

Andy
-- 
http://wingolog.org/



reply via email to

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