guile-devel
[Top][All Lists]
Advanced

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

Re: Guile-2.2 - goops setters should be inherited, no matter what :)


From: Christopher Allan Webber
Subject: Re: Guile-2.2 - goops setters should be inherited, no matter what :)
Date: Tue, 28 Feb 2017 13:48:51 -0600
User-agent: mu4e 0.9.18; emacs 25.1.1

David Pirotte writes:

>       - both the accessor and the setter should be inherited

I've run into unexpected issues where I redefined a slot and didn't
remember to set the same getter/setter/accessor.  I'd also love to see
that be an inherited.  It would lead to less goofups in my code.

But why just setters and accessors?  Why not also getters?

  scheme@(guile-user)> (use-modules (oop goops))
  scheme@(guile-user)> (define-class <forp> ()
                         (da-slot #:init-keyword #:da-slot
                                  #:getter get-da-slot))
  scheme@(guile-user)> (define-class <borp> (<forp>)
                         (da-slot #:init-value "moop"))
  scheme@(guile-user)> (get-da-slot (make <borp>))
  ERROR: In procedure scm-error:
  ERROR: No applicable method for #<<generic> get-da-slot (1)> in call 
(get-da-slot #<<borp> 22180a0>)

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

It may also be worth asking, what other slot fields get inherited?
Would #:init-keyword?  #:init-value?  #:init-thunk?  Inheriting
#:init-value and #:init-thunk both could be confusing (what does CLOS
do?).  What about #:allocation?



reply via email to

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