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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: David Pirotte <david@HIDDEN>; dated Thu, 24 Jan 2019 01:21:02 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Jan 2019 01:20:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 23 20:20:03 2019
Received: from localhost ([127.0.0.1]:43180 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gmTgZ-0002DQ-Eq
	for submit <at> debbugs.gnu.org; Wed, 23 Jan 2019 20:20:03 -0500
Received: from eggs.gnu.org ([209.51.188.92]:55736)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <david@HIDDEN>) id 1gmTgW-0002Cs-Sl
 for submit <at> debbugs.gnu.org; Wed, 23 Jan 2019 20:20:01 -0500
Received: from lists.gnu.org ([209.51.188.17]:41306)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <david@HIDDEN>) id 1gmTgR-0006i0-KB
 for submit <at> debbugs.gnu.org; Wed, 23 Jan 2019 20:19:55 -0500
Received: from eggs.gnu.org ([209.51.188.92]:37681)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <david@HIDDEN>) id 1gmTgM-0006zK-V8
 for bug-guile@HIDDEN; Wed, 23 Jan 2019 20:19:54 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <david@HIDDEN>) id 1gmTgM-0006fI-7A
 for bug-guile@HIDDEN; Wed, 23 Jan 2019 20:19:50 -0500
Received: from maximusconfessor.all2all.org ([79.99.200.102]:53366)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <david@HIDDEN>)
 id 1gmTgL-0006d4-Sd; Wed, 23 Jan 2019 20:19:50 -0500
Received: from localhost (localhost [127.0.0.1])
 by maximusconfessor.all2all.org (Postfix) with ESMTP id 00D3B1BE00E6;
 Thu, 24 Jan 2019 02:19:47 +0100 (CET)
Received: from maximusconfessor.all2all.org ([127.0.0.1])
 by localhost (maximusconfessor.all2all.org [127.0.0.1]) (amavisd-new,
 port 10024)
 with ESMTP id MNstDJac7BCz; Thu, 24 Jan 2019 02:19:46 +0100 (CET)
Received: from capac (unknown [177.98.10.100])
 by maximusconfessor.all2all.org (Postfix) with ESMTPSA id C6ADE1BE00E0;
 Thu, 24 Jan 2019 02:19:45 +0100 (CET)
Date: Wed, 23 Jan 2019 23:19:39 -0200
From: David Pirotte <david@HIDDEN>
To: <bug-guile@HIDDEN>, guile-devel <guile-devel@HIDDEN>
Subject: GOOPS - metaclass with extra-slots made trying to define a getter,
 a setter or an accessor will raise an exception
Message-ID: <20190123231939.0a6115e6@capac>
X-Mailer: Claws Mail 3.17.2 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
 boundary="Sig_/0RnbqR+A..mrpnw3ro8uSHw"; protocol="application/pgp-signature"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 79.99.200.102
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--Sig_/0RnbqR+A..mrpnw3ro8uSHw
Content-Type: multipart/mixed; boundary="MP_/=Fbyds6quu6u=hiWGWlrem1"

--MP_/=Fbyds6quu6u=hiWGWlrem1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hello,

Using a metaclass that defines extra-slots, will only work if the extra-slo=
ts 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 except=
ion.
Attached a code snipset to reproduce the error: drop it anywhere and load i=
t, 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=20
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 c=
ode
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=3D0
;;;       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 (sl=
ot)> (#<<slot> x 563eb337f=E2=80=A6> =E2=80=A6))
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]>=20

--MP_/=Fbyds6quu6u=hiWGWlrem1
Content-Type: text/x-scheme
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=foo-acc.scm


(define-module (foo-acc)
  #:use-module (oop goops)

  #:export (<foo-class>
            <foo>))


(define %props
  '("x"
    "y"))


(define-class <foo-class> (<class>))

(define (compute-extra-slots props slots)
  (map (lambda (prop)
         (let ((name (string->symbol prop))
               (acc (string->symbol (string-append "!" prop)))
               #;(gen (make <generic> #:name acc)))
           #;(module-define! (current-module) acc gen)
           #;(make <slot> #:name name)
           #;(make <slot> #:name name #:getter name)
           (make <slot> #:name name #:accessor acc)))
    props))

(define-method (compute-slots (class <foo-class>))
  (let* ((slots (next-method))
         (extra (compute-extra-slots %props slots)))
    (slot-set! class 'direct-slots
               (append (slot-ref class 'direct-slots)
                       extra))
    (append slots extra)))


(define-class <foo> ()
  #:metaclass <foo-class>)

--MP_/=Fbyds6quu6u=hiWGWlrem1--

--Sig_/0RnbqR+A..mrpnw3ro8uSHw
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEhCJlRZtBM3furJHe83T9k6MFetcFAlxJEqsACgkQ83T9k6MF
etc7BwgAm4VDw9kzp+bPBsbXcpnP5cwHzk5MVqvP7I54w9qEaVFmYHgSPHWFkusH
JVHalbVJfolA5N7ZPwDwFXjoXB3olbi+EdKeoLGUAvmGRLRmHVKv7w4I/X+JL3tK
ORpDwt6NOSfgA5BL/r+JFo121AYNrpRYdntC809r4P74zO0ancbbvKml0kesGAJ8
hP0SOQr4vycuSUege86kZolrLaorwu1DxBG+BG+3sUFsshDE6oIIg7dtAqSYmpB4
d1fsqrcl0vqgtY9D/qpBrKfTb6oiEhoMVlriHCTgZoGVVJUrDCuzLsphlnaQeLnH
B+WuIIpXnfJ45rmqvoPbucaQhfcLTA==
=/KNs
-----END PGP SIGNATURE-----

--Sig_/0RnbqR+A..mrpnw3ro8uSHw--




Acknowledgement sent to David Pirotte <david@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#34185; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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