[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36691: GOOPS: accessor breaks inherited slots with getters
From: |
Thompson, David |
Subject: |
bug#36691: GOOPS: accessor breaks inherited slots with getters |
Date: |
Tue, 16 Jul 2019 10:21:31 -0400 |
Hi,
When a subclass inherits a slot with a getter, but a previously
defined class creates an accessor with the same name, the inherited
getter is seemingly ignored and an error is thrown when attempting to
use the getter on an instance of the subclass. It's hard to explain
in a clear way, so here's a minimal example that demonstrates the
problem:
(use-modules (oop goops))
(define-class <cat> ()
(name #:getter name #:init-keyword #:name))
(define-class <boat> ()
(name #:accessor name #:init-keyword #:name))
(define-class <leopard> (<cat>))
(display (name (make <cat> #:name "Mittens")))
(newline)
(display (name (make <boat> #:name "Boaty McBoatface")))
(newline)
(display (name (make <leopard> #:name "Spot")))
(newline)
This program outputs "Mittens" and "Boaty McBoatface" then prints a
backtrace when it should print "Spot":
Backtrace:
7 (apply-smob/1 #<catch-closure 5556814626c0>)
In ice-9/boot-9.scm:
702:2 6 (call-with-prompt ("prompt") #<procedure 55568147c920 …> …)
In ice-9/eval.scm:
619:8 5 (_ #(#(#<directory (guile-user) 555681529750>)))
In ice-9/boot-9.scm:
2296:4 4 (save-module-excursion #<procedure 55568153acc0 at ice-…>)
3816:12 3 (_)
In /home/dthompson/Code/starling/examples/tetra/test.scm:
15:9 2 (_)
In oop/goops.scm:
1460:4 1 (cache-miss #<<leopard> 5556815fd730>)
1585:2 0 (goops-error _ . _)
oop/goops.scm:1585:2: In procedure goops-error:
No applicable method for #<<accessor> name (2)> in call (name
#<<leopard> 5556815fd730>)
I am using Guile 2.9.2 on GNU/Linux.
- Dave
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#36691: GOOPS: accessor breaks inherited slots with getters,
Thompson, David <=