From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Pirotte Newsgroups: gmane.lisp.guile.bugs Subject: bug#20423: goops - inheritance of slot options Date: Fri, 24 Apr 2015 23:05:38 -0300 Message-ID: <20150424230538.67db3eaa@capac> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/lxcRwVD_+dtKi_IpLWz6/YA"; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1429927651 11164 80.91.229.3 (25 Apr 2015 02:07:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Apr 2015 02:07:31 +0000 (UTC) To: 20423@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Apr 25 04:07:17 2015 Return-path: Envelope-to: guile-bugs@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 1YlpUw-0002zg-6K for guile-bugs@m.gmane.org; Sat, 25 Apr 2015 04:07:14 +0200 Original-Received: from localhost ([::1]:47095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlpUu-0002WQ-MP for guile-bugs@m.gmane.org; Fri, 24 Apr 2015 22:07:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlpUp-0002Vp-LB for bug-guile@gnu.org; Fri, 24 Apr 2015 22:07:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlpUk-0004V5-Lp for bug-guile@gnu.org; Fri, 24 Apr 2015 22:07:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlpUk-0004Uz-IO for bug-guile@gnu.org; Fri, 24 Apr 2015 22:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YlpUk-0008Jf-54 for bug-guile@gnu.org; Fri, 24 Apr 2015 22:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Pirotte Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 25 Apr 2015 02:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20423 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.142992759131921 (code B ref -1); Sat, 25 Apr 2015 02:07:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Apr 2015 02:06:31 +0000 Original-Received: from localhost ([127.0.0.1]:39095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YlpUE-0008Il-MS for submit@debbugs.gnu.org; Fri, 24 Apr 2015 22:06:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38070) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YlpUD-0008IY-1E for submit@debbugs.gnu.org; Fri, 24 Apr 2015 22:06:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlpU6-0004Qj-AB for submit@debbugs.gnu.org; Fri, 24 Apr 2015 22:06:23 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:46612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlpU6-0004Qa-7a for submit@debbugs.gnu.org; Fri, 24 Apr 2015 22:06:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlpU4-0001n2-H4 for bug-guile@gnu.org; Fri, 24 Apr 2015 22:06:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlpTv-0004Oy-F2 for bug-guile@gnu.org; Fri, 24 Apr 2015 22:06:20 -0400 Original-Received: from maximusconfessor.all2all.org ([79.99.200.102]:40055) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlpTv-0004NJ-71 for bug-guile@gnu.org; Fri, 24 Apr 2015 22:06:11 -0400 Original-Received: from localhost (unknown [192.168.0.2]) by maximusconfessor.all2all.org (Postfix) with ESMTP id 49B77A04C173 for ; Sat, 25 Apr 2015 04:05:49 +0200 (CEST) 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 6QplZDNyBToj for ; Sat, 25 Apr 2015 04:05:42 +0200 (CEST) Original-Received: from capac (unknown [179.210.41.179]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id A7E9EA04C0EF for ; Sat, 25 Apr 2015 04:05:41 +0200 (CEST) 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-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7778 Archived-At: --Sig_/lxcRwVD_+dtKi_IpLWz6/YA Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello, GNU Guile 2.0.11.114-649ec goops - inheritance of slot options severity - serious The current goops implementation breaks the [clos] protocol [*] for inherit= ance of slot options. This is a serious bug. Below, [A] what stklos does, [B] what goops does, [*] a summary of what the= clos protocol says wrt inheritance of slot options. Cheers, David [A] Here is what stklos does: stklos/subclass-slot-redefinition.scm --8<---------------cut here---------------start------------->8--- (define-class () ((name :accessor name :init-keyword :name :init-form "") (age :accessor age :init-keyword :age :init-form -1))) (define-class () ((subject :accessor subject :init-keyword :subject :init-form ""))) (define-class () ((subject :init-form "Mathematics"))) --8<---------------cut here---------------end-------------->8--- david@capac:~/alto/projects/stklos 15 $ stklos * STklos version 1.10 * Copyright (C) 1999-2011 Erick Gallesio - Universite de Nice * * [Linux-3.16.0-4-amd64-x86_64/pthread/readline/utf8] stklos> (load "subclass-slot-redefinition.scm") stklos> (define p2 (make :name 'john :age 34)) ;; p2 stklos> (describe p2) #[ 28a2420] is an an instance of class . Slots are:=20 age =3D 34 name =3D john subject =3D "Mathematics" stklos> (subject p2) "Mathematics" stklos>=20 [B] Here is what goops does: goops/subclass-slot-redefinition.scm --8<---------------cut here---------------start------------->8--- (use-modules (oop goops)) (define-class () (name #:accessor name #:init-keyword #:name #:init-form "") (age #:accessor age #:init-keyword #:age #:init-form -1)) (define-class () (subject #:accessor subject #:init-keyword #:subject #:init-form "")) (define-class () (subject #:init-form "Mathematics")) --8<---------------cut here---------------end-------------->8--- david@capac:~/alto/projects/guile-tests/goops 51 $ guile 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)> (load "subclass-slot-redefinition.scm") ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /usr/alto/projects/guile-tests/goops/subclass-slot-redefiniti= on.scm ;;; compiled /home/david/.cache/guile/ccache/2.0-LE-8-2.0/usr/alto/projects/gui= le-tests/goops/subclass-slot-redefinition.scm.go scheme@(guile-user)> (define p2 (make #:name 'john #:age 34= )) scheme@(guile-user)> ,use (oop goops describe) scheme@(guile-user)> (descri= be p2) #< 1432300> is an instance of class Slots are:=20 name =3D john age =3D 34 subject =3D "Mathematics" scheme@(guile-user)> (subject p2) ERROR: In procedure scm-error: ERROR: No applicable method for #< subject (1)> in call (subject #< 1432300>) Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]>=20 [*] A summary of what the clos protocol says: [ this is a copy/paste from a clos tutorial, also pointed by [ the Stklos reference manual: [ http://www.aiai.ed.ac.uk/~jeff/clos-guide.html#slots When there are superclasses, a subclass can specify a slot that has already been specified for a superclass. When this happens, the information in slot options has to be combined. For the slot options listed above, either the option in the subclass overrides the one in the superclass or there is a union: :ACCESSOR - union :INITARG - union :INITFORM - overrides This is what you should expect. The subclass can change the default initial value by overriding the :initform, and can add to the initargs and accesso= rs. However, the union for :accessor is just a consequence of how generic functions work. If they can apply to instances of a class C, they can also apply to instances of subclasses of C. (Accessor functions are generic.) --Sig_/lxcRwVD_+dtKi_IpLWz6/YA Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJVOvZyAAoJEPN0/ZOjBXrXe/EIAKl/G54SyQNgWSC2ClE0nTvK W/IONbSCKicD1aqKlXsBuvQCHF4YGpyxlfBO0Dg9buR/THcY70Tii5mYQjo1C6IT VFEirJDoZjxpR9Nu+4fdaY8NF4eEYMiC6dWA23gWr5MyhoxM86tHu70F0Q7PRI0K 4HGklopZD68wPw0G5yFGtaNe4h+hY8I/H5TBBk7O3ZD44TUwrwm4krp8b6+ZYsqk EzRPegu8csbLUAgxwsRoF2VEYASPWriMvabBFajCk8kqJ+EvgD9GxEl4pgXsdQfH 4CeLhCz2vmne1pneAXIFV3Phz8QsMPxuxIGwyTDZ3TPZbdRim+RvAJwX5HRm0ck= =CF3n -----END PGP SIGNATURE----- --Sig_/lxcRwVD_+dtKi_IpLWz6/YA--