From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Pirotte Newsgroups: gmane.lisp.guile.devel Subject: Re: goops - guile-clutter unexpected bug while using #:virtual slot allocation for a subclass Date: Sat, 7 Feb 2015 14:08:12 -0200 Message-ID: <20150207140812.00c94f72@capac> References: <20141219174633.6efb845e@capac> <8761btfcni.fsf@pobox.com> <20150126230044.2d1e71de@capac> <87sieweie4.fsf@pobox.com> <20150127171115.6172ccea@capac> <87zj94c5rv.fsf@pobox.com> <20150130115015.5c8e3192@capac> <878ugb9nbk.fsf@pobox.com> <20150206150933.09e166f6@capac> <87a90r7wwr.fsf@pobox.com> <20150206220637.310db45e@capac> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/Y2KOrUKb2xy.6JQYILiPkgz"; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1423325322 8652 80.91.229.3 (7 Feb 2015 16:08:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Feb 2015 16:08:42 +0000 (UTC) Cc: guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Feb 07 17:08:41 2015 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YK7vy-0005pS-FC for guile-devel@m.gmane.org; Sat, 07 Feb 2015 17:08:38 +0100 Original-Received: from localhost ([::1]:53610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YK7vx-0002gt-Gh for guile-devel@m.gmane.org; Sat, 07 Feb 2015 11:08:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YK7vt-0002gb-Pl for guile-devel@gnu.org; Sat, 07 Feb 2015 11:08:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YK7vo-00016v-Pw for guile-devel@gnu.org; Sat, 07 Feb 2015 11:08:33 -0500 Original-Received: from maximusconfessor.all2all.org ([79.99.200.102]:46414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YK7vo-00016q-HX for guile-devel@gnu.org; Sat, 07 Feb 2015 11:08:28 -0500 Original-Received: from localhost (unknown [192.168.0.2]) by maximusconfessor.all2all.org (Postfix) with ESMTP id 5DFA6A04C0C5; Sat, 7 Feb 2015 17:08:27 +0100 (CET) Original-Received: from maximusconfessor.all2all.org ([192.168.0.1]) by localhost (maximusconfessor.all2all.org [192.168.0.2]) (amavisd-new, port 10024) with ESMTP id 1reshX6W4j9R; Sat, 7 Feb 2015 17:08:15 +0100 (CET) Original-Received: from capac (unknown [179.210.40.117]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id E6378A04C0E3; Sat, 7 Feb 2015 17:08:14 +0100 (CET) In-Reply-To: <20150206220637.310db45e@capac> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 79.99.200.102 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17655 Archived-At: --Sig_/Y2KOrUKb2xy.6JQYILiPkgz Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello Andy, > > With the stable-2.0 or master branches, the current behavior is: > >=20 > > scheme@(guile-user)> (use-modules (oop goops)) > > scheme@(guile-user)> (define-class () > > ... (foo #:getter foo #:init-keyword #:foo)) > > scheme@(guile-user)> (define-class ()) > > scheme@(guile-user)> (define obj (make #:foo 34)) > > scheme@(guile-user)> (define-method (foo (self )) > > ... (pk "ahoy!") > > ... (next-method)) > > scheme@(guile-user)> (pk (foo obj)) > >=20 > > ;;; ("ahoy!") > > ERROR: In procedure scm-error: > > ERROR: No next method when calling #< foo (2)> > > with arguments (#< 2c207e0>) > >=20 > > Entering a new prompt. Type `,bt' for a backtrace or `,q' to conti= nue. > > scheme@(guile-user) [1]>=20 >=20 > Yes, expected, but to me, it is because of what I just said here below. >=20 > > > In this case indeed, the only method that exists and is applicable is > > > the getter foo that defines and inherits: there is no > > > next-method and calling (next-method) would be a user bug, in my > > > opinion too. > >=20 > > So, we should be precise with terminology :) In GOOPS, subclasses do > > not inherit accessor methods. (There was a bug in which they would; I > > fixed that.) Each subclass gets its own accessor method defined, if and > > only if it has the corresponding slot, and that method is not inherited. Some are, some are not...: ;;; module a.scm starts here (define-module (a) #:use-module (oop goops) #:export ( !v !width set-width)) (define-class () (v #:accessor !v #:init-keyword #:v #:allocation #:virtual #:slot-ref (lambda (self) (pk "this is v slot-ref, hello!")) #:slot-set! (lambda (self value) (pk "this is v slot-set!, hello!"))) (width #:accessor !width #:init-keyword #:width #:init-value 0)) (define-method ((setter !width) (self ) width) (set-width self width)) (define-method (set-width (self ) width) ;; here comes complex code, computing earth orbit, captain's age... (pk "this is !width setter method, hello!") (slot-set! self 'width width) width) ;;; module ends here ;;; module b.scm starts here (define-module (b) #:use-module (oop goops) #:use-module (a) #:export () #:re-export (!v !width set-width)) (define-class ()) ;;; module ends here GNU Guile 2.0.11.114-649ec Copyright (C) 1995-2014 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)>=20 scheme@(guile-user)> ,use (oop goops) scheme@(guile-user)> ,use (b) ;;; note: source file ./b.scm ;;; newer than compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/= usr/alto/projects/guile-tests/goops/setter-inheritance-bug/b.scm.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling ./b.scm ;;; note: source file ./a.scm ;;; newer than compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/= usr/alto/projects/guile-tests/goops/setter-inheritance-bug/a.scm.go ;;; compiling ./a.scm ;;; compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects= /guile-tests/goops/setter-inheritance-bug/a.scm.go ;;; compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects= /guile-tests/goops/setter-inheritance-bug/b.scm.go scheme@(guile-user)> (make ) $2 =3D #< 2334760> scheme@(guile-user)> (!v $2) ;;; ("this is v slot-ref, hello!") $3 =3D "this is v slot-ref, hello!" scheme@(guile-user)> (set! (!v $2) 'blue) ;;; ("this is v slot-set!, hello!") $4 =3D "this is v slot-set!, hello!" scheme@(guile-user)> (set! (!width $2) 10) $5 =3D 10 scheme@(guile-user)>=20 Cheers, David --Sig_/Y2KOrUKb2xy.6JQYILiPkgz Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJU1jhsAAoJEPN0/ZOjBXrX78IH/i043BqDmE7VyFCy9sYS0tVT Ke2uikCZvS9ud8Q2WQYYmG+9rAKRw0D2EvZRXf0GCko0N6bT7lDzpkX8BJNMHrNf nrKjnLWUcytcHUUAn/NJsw98p1cfPdqESOUkXPocR5sALEpceh6rF1So9xQ9jTJB 40vLz4R1wMTxV1Z/SjQhi0K0cRHLZbd67Uj+lica4lKsveX6AykJNUhmZNWbCB5K p6MVZ1MtXAmQ3tdlKPUlZVM9ZM1tAvCK9BffnaIC2wLcr4x1fpx2PzdoaEv0xTHI ScW/VteEIBpn7/SDqZ1O0UhLqiewVF9NGs96k5S2CZrFHnSe6WdVVk3FfDb/Yag= =YyPn -----END PGP SIGNATURE----- --Sig_/Y2KOrUKb2xy.6JQYILiPkgz--