[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Accessing class slots



Consider the class:

(defclass c1 () ((s1 :allocation :class :initform "Foo")))

Then you can use (slot-value (class-prototype (find-class 'c1)) 's1) to get
your desired value.  This will cause the class to be finalized in order to
create the class prototype.
_______________________________________________________________________________
To: info-mcl@cambridge.apple.com
Cc: ranson@lannion.cnet.fr
From: Ranson on Mon, Feb 17, 1992 3:51 AM
Subject: Accessing class slots
Received: by AT-MAIL-SERVER.VITRO.COM (2.00/GatorMail) with SMTP/TCP;17 Feb 92
03:51:44 U
Received: by vitro.com (5.57/Ultrix3.0-C)
	id AA13426; Mon, 17 Feb 92 03:49:48 -0500
Received: from ministry.cambridge.apple.com by brazil.cambridge.apple.com with
SMTP (5.64/25-eef)
	id AA16136; Mon, 17 Feb 92 03:50:33 -0500
	for pierce@vitro.com
Received: by cambridge.apple.com (5.64/25-eef)
	id AA02633; Mon, 17 Feb 92 03:42:30 -0500
Received: from brazil.cambridge.apple.com by cambridge.apple.com with SMTP
(5.64/25-eef)
	id AA02616; Mon, 17 Feb 92 03:42:13 -0500
Received: from pamir.inria.fr by brazil.cambridge.apple.com with SMTP
(5.64/25-eef)
	id AA16112; Mon, 17 Feb 92 03:47:32 -0500
	for info-mcl@cambridge.apple.com
X400-Received: by /PRMD=inria/ADMD=atlas/C=FR/;
	Relayed; 17 Feb 92 09:46:08+0100
X400-Received: by /PRMD=CNET/ADMD=ATLAS/C=FR/;
	Relayed; 17 Feb 92 09:47:00 GMT
Date: 17 Feb 92 09:47:00 GMT
From: Ranson <ranson@lannion.cnet.fr>
Message-Id: <m0lG40I-000006C@lamd01>
To: info-mcl@cambridge.apple.com
Subject: Accessing class slots
Cc: ranson@lannion.cnet.fr

This si not really a MCL question, but I know this list has many CLOS
wizards...
In C++, there is a syntax for accessing static members (= class slots) without
using an object of the class, with class_name::slot_name. From my knowledge of
CLOS, you must use SLOT-VALUE or an accessor function on an instance to access
a class slot. Have I missed something, or is there really no direct access to
class slots? If so, why?
     Daniel.