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

RE: Question about class variables



Yes, use class-prototype...

(defclass c1 () ((s1 :allocation :class :initform 'foo)))

(slot-value (class-prototype (find-class 'c1)) 's1) => foo

-Jonathan
_______________________________________________________________________________
To: info-mcl@cambridge.apple.com
From: John Louch on Fri, Feb 28, 1992 10:15 AM
Subject: Question about class variables
Received: by AT-MAIL-SERVER.VITRO.COM (2.00/GatorMail) with SMTP/TCP;28 Feb 92
10:14:43 U
Received: by vitro.com (5.57/Ultrix3.0-C)
	id AA18166; Fri, 28 Feb 92 08:21:28 -0500
Received: from ministry.cambridge.apple.com by brazil.cambridge.apple.com with
SMTP (5.64/25-eef)
	id AA10088; Fri, 28 Feb 92 08:14:44 -0500
	for pierce@vitro.com
Received: by cambridge.apple.com (5.64/25-eef)
	id AA21355; Fri, 28 Feb 92 08:05:08 -0500
Received: from brazil.cambridge.apple.com by cambridge.apple.com with SMTP
(5.64/25-eef)
	id AA21326; Fri, 28 Feb 92 08:04:57 -0500
Received: from polyslo.csc.calpoly.edu by brazil.cambridge.apple.com with SMTP
(5.64/25-eef)
	id AA10059; Fri, 28 Feb 92 08:08:04 -0500
	for info-mcl@cambridge.apple.com
Received: by polyslo.csc.calpoly.edu (5.61/2.890629)
	id AA07012; Fri, 28 Feb 92 05:05:48 -0800
Date: Fri, 28 Feb 92 05:05:48 -0800
From: jlouch@polyslo.csc.calpoly.edu (John Louch)
Message-Id: <9202281305.AA07012@polyslo.csc.calpoly.edu>
To: info-mcl@cambridge.apple.com
Subject: Question about class variables

Is there a better way to get the value of a class slot (:allocation
:class) than making a temporary instance of the class and then
accessing the slot.

I would rather not do this in another words:

(defclass aclass () 
  ((arg :allocation :class)))

(setf (slot-value (make-instance 'aclass) 'arg) 'an-argument)

Thanks,
John Louch
jlouch@apple.com
jlouch@polyslo.csc.calpoly.edu
new.guy@applelink.apple.com