🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #303

Re: class variables

#303
From: Trent Lange
Date: Thu, 01 Oct 1992 07:16
35 lines
2319 bytes
In article <CUTTING.92Sep30102223@skye.parc.xerox.com> cutting@skye.parc.xerox.com (Doug Cutting) writes:
>
>Class slots as they stand are really just global variables.  Every
>time (... :allocation :class ...) is specified only one slot is ever
>created.  It is unfortunate that the standard does not include a
>mechanism which causes a new slot to be allocated per subclass.  This
>would add new functionality to the language.  As it stands, class
>allocation approximates DEFVAR.

I have to agree with this.  Though the current :allocation :class option
is certainly more useful than defvar (as Barry points out), it would be
*very* useful if there was an slot :allocation option that allocated
:class-like slots per subclass -- maybe an option called :class-class
or something.  

It would definitely add functionality to CLOS, and in a very intuitive way,
so that (setf (slot-value (class-prototype classA) 'class-class-slot) X)
would set the slot-values of all instances of classA to X, without
changing the slot-values of instances of other classes.

Such an :allocation option would be trivial to implement for vendors
given the existence of the :class option already.  In fact, knowing
the internals of PCL, it is about a three-line patch to allow a very
efficient :class-class :allocation option.  Unfortunately, it is (currently)
not possibly to make one's own :class-class option efficient in a
portable fashion.

Is this the kind of thing that might be put up for review in the proposed
dpANS Common Lisp standard?

(As a side note, I could make an efficient, but PCL-specific metaclass
that allows a :class-class option available for the next version of
PCL if people are interested.)

- Trent Lange
Technical Details
Message-ID: <1992Oct1.071605.8674@cs.ucla.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!sun-barr!ames!elroy.jpl.nasa.gov!ucla-cs!lanai.cs.ucla.edu!lange
References: <HALTRAET.92Sep30032338@monsun.si.no> <CUTTING.92Sep30102223@skye.parc.xerox.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!sun-barr!ames!elroy.jpl.nasa.gov!ucla-cs!lanai.cs.ucla.edu!lange
From: lange@lanai.cs.ucla.edu (Trent Lange)
Subject: Re: class variables
Message-ID: <1992Oct1.071605.8674@cs.ucla.edu>
Sender: usenet@cs.ucla.edu (Mr Usenet)
Nntp-Posting-Host: lanai.cs.ucla.edu
Organization: UCLA Artificial Intelligence Laboratory
References: <HALTRAET.92Sep30032338@monsun.si.no> <CUTTING.92Sep30102223@skye.parc.xerox.com>
Date: Thu, 1 Oct 92 07:16:05 GMT
Lines: 36