From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ludovic =?iso-8859-1?Q?Court=E8s?= Newsgroups: gmane.lisp.guile.user Subject: [GOOPS] Accessing a class slot Date: Tue, 20 Jul 2004 19:21:49 +0200 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <20040720172147.GD986@cassis.laas.fr> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1090347899 1714 80.91.224.253 (20 Jul 2004 18:24:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 20 Jul 2004 18:24:59 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jul 20 20:24:46 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BmzID-0008I3-00 for ; Tue, 20 Jul 2004 20:24:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BmzKx-00032O-R0 for guile-user@m.gmane.org; Tue, 20 Jul 2004 14:27:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BmzKt-00031X-8w for guile-user@gnu.org; Tue, 20 Jul 2004 14:27:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BmzKr-00031I-KU for guile-user@gnu.org; Tue, 20 Jul 2004 14:27:31 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BmzKr-00031F-Hh for guile-user@gnu.org; Tue, 20 Jul 2004 14:27:29 -0400 Original-Received: from [213.228.0.176] (helo=postfix4-2.free.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BmzI1-0005GH-85 for guile-user@gnu.org; Tue, 20 Jul 2004 14:24:33 -0400 Original-Received: from cassis.glacis.crous (languedoc-5-82-225-111-76.fbx.proxad.net [82.225.111.76]) by postfix4-2.free.fr (Postfix) with ESMTP id 2379F1A8E16 for ; Tue, 20 Jul 2004 20:24:32 +0200 (CEST) Original-Received: by cassis.glacis.crous (Postfix, from userid 1000) id 2A6733E698; Tue, 20 Jul 2004 19:21:49 +0200 (CEST) Original-To: guile-user@gnu.org Mail-Followup-To: guile-user@gnu.org Content-Disposition: inline X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://ludo.humanoidz.org/ludovic.asc X-OS: GNU/Linux X-URL: http://ludo.humanoidz.org/ User-Agent: Mutt/1.5.4i [Guile enabled] X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 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 Xref: main.gmane.org gmane.lisp.guile.user:3333 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:3333 Hi, I noticed (using Guile 1.6.4) that trying to access a class-wide slot (eg. via `class-slot-ref') before creating an instance of that class always fails. However, it does work once at least one instance of the class has been created via `make'. This behavior looks quite weird to me: I was expecting class-wide slots to be available right after the class has been defined (just like C++ `static' class attributes are). In particular, I wanted to access a class slot from within that class' `initialize' method which turns out to not be feasible because of this. I worked around it by creating a particular metaclass for the class in question and then by specializing `slot-unbound' for that metaclass: (define-class ()) (define-class [...] #:metaclass ) (define-method (slot-unbound (class ) slot-name) (if (eq? class) '() (next-method))) However, although interesting, this technique is definitely not the right way IMO. ;-) What do people think about this issue? Thanks, Ludovic. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user