Re: Uses of :allocation :class?

From: Raymond Toy (toy_at_rtp.ericsson.se)
Date: 06/10/04


Date: Thu, 10 Jun 2004 12:04:42 -0400


>>>>> "Peter" == Peter Seibel <peter@javamonkey.com> writes:

    Peter> Anyone have any favorite idioms involving :allocation :class slots. I

I don't have a favorite idiom, but I did use :allocation :class slots
on a particular project. Not sure what I did was really right, but it
seemed to work how I wanted.

I had a base class that had the default slot allocation. Then there
were several subclasses derived from the base class. In these
subclasses, I made the slot :allocation :class because this slot was
the same for all instances of the subclass. I didn't want to use
standard allocation because the value was quite large (2K words or
more), and I expected to have a fair number of instances.

I could have just made the slot value a global constant and had the
slot point to the global constant, I suppose, but that kind of broke
the connection between the object and what data it carried.

Besides it let me play around with something new. :-)

Ray



Relevant Pages

  • Re: Class instance variables, class variables and constants
    ... Inherited by subclasses ... SAME ALLOCATION: If it's changed in Child, then it will change in Parent ... def a.bar ... singleton classes don't have their own class variables, but they can have their own constants ...
    (comp.lang.ruby)
  • Re: Uses of :allocation :class?
    ... Raymond Toy writes: ... > I had a base class that had the default slot allocation. ... SLOT-VALUE interface. ...
    (comp.lang.lisp)