Class slots in CLOS




Greetings,

It seems to me that there are two ways to define class slots (slots common to all instances of the class) in CLOS as follows:

1. via the use of :allocation :class slot option

2. By the creation and use of a meta-class that is to house the shared slots for a given class or set of classes.

I suppose my main question is what is the difference. I'm pretty sure method #1 is easier to declare and access to the class slots is easier (just like instance slots). Is one faster than the other.

I understand that using method #2 is more flexible and theoretically pure. Or, is method #1 just a shorthand for method #2?

Thanks.

Blake McBride
.



Relevant Pages

  • Re: Class slots in CLOS
    ... It seems to me that there are two ways to define class slots (slots ... common to all instances of the class) in CLOS as follows: ... Why do you say that #2 is "theoretically pure"? ... A problem of #2 is that meta classes don't compose, ...
    (comp.lang.lisp)
  • Re: Class slots in CLOS
    ... It seems to me that there are two ways to define class slots (slots common to all instances of the class) in CLOS as follows: ... There is an important technical difference, which also implies a semantical difference. ... (defclass foo-class () ...
    (comp.lang.lisp)