GNU bug report logs - #36691
GOOPS: accessor breaks inherited slots with getters

Previous Next

Package: guile;

Reported by: "Thompson, David" <dthompson2 <at> worcester.edu>

Date: Tue, 16 Jul 2019 14:22:01 UTC

Severity: normal

To reply to this bug, email your comments to 36691 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#36691; Package guile. (Tue, 16 Jul 2019 14:22:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Thompson, David" <dthompson2 <at> worcester.edu>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Tue, 16 Jul 2019 14:22:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Thompson, David" <dthompson2 <at> worcester.edu>
To: bug-guile <at> gnu.org
Subject: 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




This bug report was last modified 5 years and 332 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.