GNU bug report logs - #34185
GOOPS - metaclass with extra-slots made trying to define a getter, a setter or an accessor will raise an exception

Previous Next

Package: guile;

Reported by: David Pirotte <david <at> altosw.be>

Date: Thu, 24 Jan 2019 01:21:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: David Pirotte <david <at> altosw.be>
To: 34185 <at> debbugs.gnu.org, guile-devel <at> gnu.org
Subject: bug#34185: GOOPS - metaclass with extra-slots made trying to define a getter, a setter or an accessor will raise an exception
Date: Wed, 23 Jan 2019 23:19:39 -0200
[Message part 1 (text/plain, inline)]
Hello,

Using a metaclass that defines extra-slots, will only work if the extra-slots are
made 'exclusively' using the expression:

	(make <slot> #:name name)

If one tries to pass a setter, a getter or an accessor, it raises an exception.
Attached a code snipset to reproduce the error: drop it anywhere and load it, then
enter ',bt' to see the backtrace ...

	I pasted the error I get, below my signature, so one can compare
	I am using Guile 2.2.4.1-cdb19

As you can see, the error is triggered by (oop goops) add-method! - called by 
compute-slot-accessors - which complains that the accessor name (or getter or setter
name) is not a valid generic function.

Though I think it should be automatically created if it does not exists, I also
tried to create it - which you may try uncommenting line 20 and 21 of the code
snipset - but that didn't solve the problem.

Thanks,
David


scheme@(guile-user)> (load "/usr/alto/projects/g-golf/foo-acc.scm")
;;; note: source file /usr/alto/projects/g-golf/foo-acc.scm
;;;       newer than compiled /home/david/.cache/guile/ccache/2.2-LE-8-3.A/usr/alto/projects/g-golf/foo-acc.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /usr/alto/projects/g-golf/foo-acc.scm
;;; compiled /home/david/.cache/guile/ccache/2.2-LE-8-3.A/usr/alto/projects/g-golf/foo-acc.scm.go
scm-error!x

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(foo-acc) [1]> ,bt
In ice-9/boot-9.scm:
   2316:4  7 (save-module-excursion _)
  3835:12  6 (_)
In /usr/alto/projects/g-golf/foo-acc.scm:
     36:0  5 (_)
In oop/goops.scm:
   3032:4  4 (_ _ . _)
   2925:2  3 (_ #<<foo-class> <foo> 563eb337f360> _)
In srfi/srfi-1.scm:
    640:9  2 (for-each #<procedure 563eb2b3b4c0 at oop/goops.scm:2720:3 (slot)> (#<<slot> x 563eb337f…> …))
In oop/goops.scm:
   2730:9  1 (_ #<<slot> x 563eb337f1b0>)
In unknown file:
           0 (scm-error goops-error #f "~S is not a valid generic function" (!x) ())
scheme@(foo-acc) [1]> 
[foo-acc.scm (text/x-scheme, attachment)]
[Message part 3 (application/pgp-signature, inline)]

This bug report was last modified 6 years and 143 days ago.

Previous Next


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