From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: #:getter procedure returns unexpected value in GOOPS Date: Sat, 26 Apr 2014 13:26:23 +0100 Message-ID: <877g6ccm4w.fsf@ossau.homelinux.net> References: <87mwf9hu1v.fsf@nebulosa.milkyway> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1398515217 16592 80.91.229.3 (26 Apr 2014 12:26:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Apr 2014 12:26:57 +0000 (UTC) Cc: guile-user@gnu.org To: "Diogo F. S. Ramos" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Apr 26 14:26:50 2014 Return-path: Envelope-to: guile-user@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 1We1gv-00050K-6p for guile-user@m.gmane.org; Sat, 26 Apr 2014 14:26:49 +0200 Original-Received: from localhost ([::1]:33736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We1gu-00006R-PF for guile-user@m.gmane.org; Sat, 26 Apr 2014 08:26:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We1gg-000065-9J for guile-user@gnu.org; Sat, 26 Apr 2014 08:26:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1We1ga-00029E-1g for guile-user@gnu.org; Sat, 26 Apr 2014 08:26:34 -0400 Original-Received: from out1.ip05ir2.opaltelecom.net ([62.24.128.241]:15539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We1gZ-00027R-Rv for guile-user@gnu.org; Sat, 26 Apr 2014 08:26:27 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnsGAPmkW1NOlc8l/2dsb2JhbABZgwbFfoEKF3SCJQEBBAE6HCMFCwgDISUPAQQlJBOIOQzKfxeOWQeEOQSZDJJegzI8 X-IPAS-Result: AnsGAPmkW1NOlc8l/2dsb2JhbABZgwbFfoEKF3SCJQEBBAE6HCMFCwgDISUPAQQlJBOIOQzKfxeOWQeEOQSZDJJegzI8 X-IronPort-AV: E=Sophos;i="4.97,933,1389744000"; d="scan'208";a="453925663" Original-Received: from host-78-149-207-37.as13285.net (HELO arudy) ([78.149.207.37]) by out1.ip05ir2.opaltelecom.net with ESMTP; 26 Apr 2014 13:26:25 +0100 Original-Received: from neil-laptop.ossau.homelinux.net (neil-laptop [192.168.11.7]) by arudy (Postfix) with ESMTP id B1ECA380A6; Sat, 26 Apr 2014 13:26:24 +0100 (BST) In-Reply-To: <87mwf9hu1v.fsf@nebulosa.milkyway> (Diogo F. S. Ramos's message of "Fri, 25 Apr 2014 20:24:12 -0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 62.24.128.241 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11219 Archived-At: "Diogo F. S. Ramos" writes: > When using GOOPS, if a class has a second slot, the #:getter procedure > of the first slot returns the value of the second slot when applied to > an instance of a subclass. > > (use-modules (oop goops)) > > (define-class () > (a #:init-form 'foo #:getter foo-a) > (b #:init-form 42)) > > (define-class () > (a #:init-form 'bar)) > > (foo-a (make )) => foo > (foo-a (make )) => 42 > > I expected: > > (foo-a (make )) => bar > > I'm not too familiar with GOOPS, so I'm not sure this is the right > behavior. Do you see this if you use #:init-value instead of #:init-form ? It sounds to me like #:init-value is what you really want, and I suspect you're seeing undefined behaviour that arises from giving an unparenthesized form ('42') to #:init-form. Neil