guile-user
[Top][All Lists]
Advanced

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

Re: #:getter procedure returns unexpected value in GOOPS


From: Andy Wingo
Subject: Re: #:getter procedure returns unexpected value in GOOPS
Date: Mon, 09 Mar 2015 22:58:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Hi!

On Sat 26 Apr 2014 01:24, "Diogo F. S. Ramos" <address@hidden> writes:

> When using GOOPS, if a class has a second slot, the #:getter procedure
> of the first slot returns the value of the second slot when applied to
> an instance of a subclass.
>
> (use-modules (oop goops))
>
> (define-class <foo> ()
>   (a #:init-form 'foo #:getter foo-a)
>   (b #:init-form 42))
>
> (define-class <bar> (<foo>)
>   (a #:init-form 'bar))
>
>   (foo-a (make <foo>)) => foo
>   (foo-a (make <bar>)) => 42
>
> I expected:
>
>   (foo-a (make <bar>)) => bar

I realize this is really late :)  But since this thread isn't linked to
a bug, note that this is now fixed in stable-2.0 and master, to match
the behavior in Guile 1.8 and previous, which is actually that:

  (foo-a (make <bar>)) => error!

because <bar> doesn't just define a different init-value for the slot,
it defines a different slot entirely.

Andy
-- 
http://wingolog.org/



reply via email to

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