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 22:06:37 -0200 Message-ID: <20150206220637.310db45e@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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/tJUNIxwN0z6Yss0YzwPHBqS"; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1423267628 22539 80.91.229.3 (7 Feb 2015 00:07:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Feb 2015 00:07:08 +0000 (UTC) Cc: guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Feb 07 01:07:08 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 1YJsvQ-0003Qd-3H for guile-devel@m.gmane.org; Sat, 07 Feb 2015 01:07:04 +0100 Original-Received: from localhost ([::1]:50985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJsvP-0005qd-GH for guile-devel@m.gmane.org; Fri, 06 Feb 2015 19:07:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJsvL-0005qH-LM for guile-devel@gnu.org; Fri, 06 Feb 2015 19:07:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJsvG-0002GE-Ix for guile-devel@gnu.org; Fri, 06 Feb 2015 19:06:59 -0500 Original-Received: from maximusconfessor.all2all.org ([79.99.200.102]:34765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJsvG-0002G5-A6 for guile-devel@gnu.org; Fri, 06 Feb 2015 19:06:54 -0500 Original-Received: from localhost (unknown [192.168.0.2]) by maximusconfessor.all2all.org (Postfix) with ESMTP id 4B8A8A04C0EF; Sat, 7 Feb 2015 01:06:53 +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 TRtQTpJJV3nX; Sat, 7 Feb 2015 01:06:41 +0100 (CET) Original-Received: from capac (unknown [177.40.153.212]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id 5867CA04C140; Sat, 7 Feb 2015 01:06:40 +0100 (CET) In-Reply-To: <87a90r7wwr.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:17653 Archived-At: --Sig_/tJUNIxwN0z6Yss0YzwPHBqS Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi again! :) > 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 continu= e. > scheme@(guile-user) [1]>=20 Yes, expected, but to me, it is because of what I just said here below. > > 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. Here we don't agree, and to me, this is a bug, not a feature :), given that= in my opinion (1) we should follow the clos spec here, and (2) you did the right = thing in 2009, even by accident, it was a very good accident :). Besides, the follo= wing would work [i don't think it is a/the solution, the user should be 'forced'= to do that, I mention it here to show what I consider a 'contradiction']: wdyt? ;;; module a.scm starts here (define-module (a) #:use-module (oop goops) #:export ( !width set-width)) (define-class () (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 (!width set-width)) (define-class ()) ;;; module ends here GNU Guile 2.0.11.114-649ec scheme@(guile-user)> ,use (oop goops) scheme@(guile-user)> ,use (b) ;;; note: source file ./b.scm ;;; newer than ;;; ... ... ;;; note: source file ./a.scm ;;; newer than scheme@(guile-user)> (make ) $3 =3D #< 1bc1940> scheme@(guile-user)> (set-width $3 20) ;;; ("this is !width setter method, hello!") $4 =3D 20 scheme@(guile-user)>=20 > >> 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. >=20 > Nope :) That bit of the protocol was never implemented. Instead the > semantics are that the slot from the first entry in the CPL is used. Ok, I can live with that for now :) Cheers, David --Sig_/tJUNIxwN0z6Yss0YzwPHBqS Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJU1VcNAAoJEPN0/ZOjBXrXxBgIAODuYvST3AW39zuU1yuc7+rV vfYGqHfmSZwkjGW/4Qa1JbKAeRQQAq1bLmCOuJ3Ogf+9dnsVN/0IfOn1/qcJeMDs pG6fwGarrt232COMODpqB0evJUyNcpFBxSIiMjR+/9G0aopGfP7N2/5zEQ+UAnho QyY9cTjp2Ik/J1Rleg5uKlKWbqO3mz+KY6T752xk59kzpIvIDPN+mr6Av4Wv4HMs m45U3+VptAgwDVI41khr92XjXy57K32/RtFuddP+JMgt67W4XkXW0DHCGuf9lN3p WsHxBAPXhz2+lCQdgcQy8erdjaJYLzSVEMKux+a8kr7WI7kasCdjjdv7tkPRXjQ= =/1Ng -----END PGP SIGNATURE----- --Sig_/tJUNIxwN0z6Yss0YzwPHBqS--