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: Fri, 6 Feb 2015 15:09:33 -0200 Message-ID: <20150206150933.09e166f6@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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/ma3RIO+bGi3G8c7cUu/pSEa"; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1423243262 5305 80.91.229.3 (6 Feb 2015 17:21:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Feb 2015 17:21:02 +0000 (UTC) Cc: guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Feb 06 18:20:58 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 1YJmaQ-00041v-1J for guile-devel@m.gmane.org; Fri, 06 Feb 2015 18:20:58 +0100 Original-Received: from localhost ([::1]:49776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJmaP-0006pT-AC for guile-devel@m.gmane.org; Fri, 06 Feb 2015 12:20:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJmPz-0005GR-62 for guile-devel@gnu.org; Fri, 06 Feb 2015 12:10:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJmPv-0004Bu-9i for guile-devel@gnu.org; Fri, 06 Feb 2015 12:10:11 -0500 Original-Received: from maximusconfessor.all2all.org ([79.99.200.102]:35640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJmPv-0003tm-0r for guile-devel@gnu.org; Fri, 06 Feb 2015 12:10:07 -0500 Original-Received: from localhost (unknown [192.168.0.2]) by maximusconfessor.all2all.org (Postfix) with ESMTP id 1C667A04C169; Fri, 6 Feb 2015 18:09:45 +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 08BjQuHikhOO; Fri, 6 Feb 2015 18:09:37 +0100 (CET) Original-Received: from capac (unknown [179.210.40.117]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id 09833A04C122; Fri, 6 Feb 2015 18:09:36 +0100 (CET) In-Reply-To: <878ugb9nbk.fsf@pobox.com> 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:17651 Archived-At: --Sig_/ma3RIO+bGi3G8c7cUu/pSEa Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello Andy, > May I first please reduce your test case. Here is an equivalent > version: sure, especially because it is not 'my' test case :) which got us very confused: when you were talking about this one, I was thinking about another... which to remove the confusion I finally reported: bug #19770: I hope it is 'easy' to solve and hope you can fix it soon, to me this one is really important but of course I am happy to talk about this one as well, to remove all the confusion, if possible :)! and help us getting goops even better! So, wrt this reduced test, to summarize but see below for details, (1) I ag= ree with you for the first part [the code before defining ], and (2) I have a di= fferent answer from my guile version for the second part [which I think is the corr= ect answer, maybe you wanted to paste some other code [?], don't know. > (use-modules (oop goops)) > (define-class () > (foo #:getter foo #:init-keyword #:foo)) > (define-class ()) > (define obj (make #:foo 34)) > (define-method (foo (self )) > (pk "ahoy!") > (next-method)) > (pk (foo obj)) > guile> (pk (foo obj)) >=20 > ;;; ("ahoy!") >=20 > Backtrace: > In current input: > 18: 0* [peek ... > 18: 1* [foo #< 7fc8898e0e20>] > ?: 2 (let* ((next-method (goops:make-next-method self))) (pk "aho= y!") ...) >=20 > : In expression (let* (#) (pk "ahoy!") ...): > : No next method when calling #< foo (2)> > with arguments (#< 7fc8898e0e20>) I totally agree with you and with the above goops 'answer', for all our gui= le versions. In this case indeed, the only method that exists and is applicab= le is the getter foo that defines and inherits: there is no next-method and ca= lling (next-method) would be a user bug, in my opinion too. > However it wouldn't always return the value of the slot "foo"; for > example: >=20 > scheme@(guile-user)> (define-class () (bar #:init-keyword #:bar)) > scheme@(guile-user)> (define-class ( )) > scheme@(guile-user)> (define obj2 (make #:foo 34 #:bar 42)) > scheme@(guile-user)> (define-method (foo (self )) > (pk "wat!!!") > (next-method)) > scheme@(guile-user)> (pk (foo obj2)) >=20 > ;;; ("wat!!!") >=20 > ;;; (42) > $2 =3D 42 Here I am confused again: given the above, defining foo on and calling (next-method) is not different then the foo on , there is no next-method= and I get the error as well, maybe you wanted to paste some other code? Here is w= hat I get, given the definitions above (*) GNU Guile 2.0.11.114-649ec ... scheme@(guile-user)> ,use (abc) ;;; note: source file ./abc.scm ;;; newer than compiled... ;;; ... scheme@(guile-user)> ,m (abc) scheme@(abc)> (foo obj2) ;;; ("wat!!!") ERROR: In procedure scm-error: ERROR: No next method when calling #< foo (3)> with arguments (#< 15c98a0>) Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(abc) [1]>=20 > (defclass () > ((foo :reader foo :initarg :foo))) > (defclass () ()) > (defvar obj (make-instance ' :foo 34)) > (defmethod foo ((self )) > (write "ahoy!") > (call-next-method)) > (foo obj) > Interestingly, in CLISP at least this works in the way you expect: > ... Interesting indeed, and a surprise, it's been a very long time I've used CL= and CLOS. For info, sbcl also 'works' the same way, but I don't think we should imple= ment that in guile, I second you here: This is SBCL 1.2.4.debian, an implementation of ANSI Common Lisp. More information about SBCL is available at . ... * (defclass () * (defclass () ((foo :reader foo :initarg :foo))) #> * (defclass () ()) #> * (defvar obj (make-instance ' :foo 34)) OBJ * (defmethod foo ((self )) (write "ahoy!") (call-next-method)) #) {1003B3A773}> * (foo obj) "ahoy!" 34 *=20 > I am not sure how to interpret this result. Same here, I should carefully read/study the spec again I guess, but anyway= , wrt the the first part of your test case, I agree with you. > The slot definition protocol in CLOS is different; for example, > compute-effective-slot-definition in CLOS logically *combines* slot > definitions with the same name. Is it not what goops does as well? I thought so. > Could it be that in CLOS, all instances of a type are considered to hav= e all > slots of all supertypes? That is not the GOOPS design, but perhaps that = should > change. I am confused with what you mean exactly with the above sentence, which to = me is 'correct' and with which you seem to disagree? But for me, if that is what= we are talking about here, goops class-slots procedure does the right job. Cheers, And thanks! David (*) here an abc module from the defs of your email: (define-module (abc) #:use-module (oop goops)) (define-class () (foo #:getter foo #:init-keyword #:foo)) (define-class ()) (define-method (foo (self )) (pk "ahoy!") (next-method)) (define-class () (bar #:init-keyword #:bar)) (define-class ( )) (define-method (foo (self )) (pk "wat!!!") (next-method)) (define obj (make #:foo 34)) (define obj2 (make #:foo 34 #:bar 42)) --Sig_/ma3RIO+bGi3G8c7cUu/pSEa Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJU1PVNAAoJEPN0/ZOjBXrX2E0H+gNeHzIxWBE51Npi3d15E1Lo MOqxZIWio65EOPN6z3hM7JXfxlIPgOjppA7hhRhPPt/s4EdmirkYr8cqRGAeRhCr r8BrzKCjRvJSj3QU7hURVN6UYt7RJPUZIfKfoCQ5Ks9xNCXKGQuDJyutNtow2FKw tpk92/doemlBz3VhLYTE6PaH/uccvGvtJtpE4gL9feE7NzCvLtaLQAPfUTnV6QHb mzCXjndAB1qGwo8Y+HJ0YGYq611LtezNGX6rWK+JYc/CebzmIqVPc47YPDSikqdh a/HGnFIGww+hzzWQ/97DLzWZG+zd85KcPNLpCLO/ZxTOOUG1lOP+BmmIk7eyRic= =AKHH -----END PGP SIGNATURE----- --Sig_/ma3RIO+bGi3G8c7cUu/pSEa--