[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: #:getter procedure returns unexpected value in GOOPS
From: |
Neil Jerram |
Subject: |
Re: #:getter procedure returns unexpected value in GOOPS |
Date: |
Sat, 26 Apr 2014 13:26:23 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
"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'm not too familiar with GOOPS, so I'm not sure this is the right
> behavior.
Do you see this if you use #:init-value instead of #:init-form ? It
sounds to me like #:init-value is what you really want, and I suspect
you're seeing undefined behaviour that arises from giving an
unparenthesized form ('42') to #:init-form.
Neil
Re: #:getter procedure returns unexpected value in GOOPS, Mark H Weaver, 2014/04/26