From: piscesboy on
Strangely, when I created a class instance in CLOS containing more
than 8 slots, any slot values entered after the 8th are ignored. The
number of slots available to a class is supposed to be implementation
dependent, so how do I find out/change what it is for clisp on Mac OS
X?
From: Pascal J. Bourguignon on
piscesboy <oraclmaster(a)gmail.com> writes:

> Strangely, when I created a class instance in CLOS containing more
> than 8 slots, any slot values entered after the 8th are ignored. The
> number of slots available to a class is supposed to be implementation
> dependent, so how do I find out/change what it is for clisp on Mac OS
> X?


I don't observe any problem:

C/USER[19]> (defmacro defclass-with-a-lot-of-slots (class super number-of-slots)
`(defclass ,class ,super
,(loop
for i from 0 below number-of-slots
for s = (intern (format nil "SLOT-~D" i))
for k = (intern (format nil "SLOT-~D" i) "KEYWORD")
collect `(,s :accessor ,s :initarg ,k))))
DEFCLASS-WITH-A-LOT-OF-SLOTS
C/USER[20]> (defclass-with-a-lot-of-slots a () 1000)
WARNING: DEFCLASS: Class A (or one of its ancestors) is being redefined, instances are obsolete
#1=#<STANDARD-CLASS A :VERSION 1>
C/USER[21]> (defvar *a* (make-instance 'a :slot-999 999 :slot-60 60))
*A*
C/USER[22]> (defparameter *a* (make-instance 'a :slot-999 999 :slot-60 60))
*A*
C/USER[23]> (slot-60 *a*)
60
C/USER[24]> (slot-999 *a*)
999
C/USER[25]>


--
__Pascal Bourguignon__
From: piscesboy on
On Feb 24, 11:38 am, p...(a)informatimago.com (Pascal J. Bourguignon)
wrote:
> piscesboy <oraclmas...(a)gmail.com> writes:
> > Strangely, when I created a class instance in CLOS containing more
> > than 8 slots, any slot values entered after the 8th are ignored. The
> > number of slots available to a class is supposed to be implementation
> > dependent, so how do I find out/change what it is for clisp on Mac OS
> > X?
>
> I don't observe any problem:
>
> C/USER[19]> (defmacro defclass-with-a-lot-of-slots (class super number-of-slots)
>              `(defclass ,class ,super
>                 ,(loop
>                     for i from 0 below number-of-slots
>                     for s = (intern (format nil "SLOT-~D" i))
>                     for k = (intern (format nil "SLOT-~D" i) "KEYWORD")
>                     collect `(,s :accessor ,s :initarg ,k))))
> DEFCLASS-WITH-A-LOT-OF-SLOTS
> C/USER[20]> (defclass-with-a-lot-of-slots a () 1000)
> WARNING: DEFCLASS: Class A (or one of its ancestors) is being redefined, instances are obsolete
> #1=#<STANDARD-CLASS A :VERSION 1>
> C/USER[21]> (defvar *a* (make-instance 'a :slot-999 999 :slot-60 60))
> *A*
> C/USER[22]> (defparameter *a* (make-instance 'a :slot-999 999 :slot-60 60))
> *A*
> C/USER[23]> (slot-60 *a*)
> 60
> C/USER[24]> (slot-999 *a*)
> 999
> C/USER[25]>
>
> --
> __Pascal Bourguignon__

I used the 'make-instance macro. Is that the issue?
From: Tamas K Papp on
On Wed, 24 Feb 2010 06:50:48 -0800, piscesboy wrote:

> number of slots available to a class is supposed to be implementation
> dependent

This is probably my ignorance, but where does it say this in the HS?

Thanks,

Tamas


From: piscesboy on
On Feb 24, 1:24 pm, Tamas K Papp <tkp...(a)gmail.com> wrote:
> On Wed, 24 Feb 2010 06:50:48 -0800, piscesboy wrote:
> > number of slots available to a class is supposed to be implementation
> > dependent
>
> This is probably my ignorance, but where does it say this in the HS?
>
> Thanks,
>
> Tamas

Hmmmm...I wondered about that too, so I read it again, here:

http://cl-cookbook.sourceforge.net/clos-tutorial/index.html

Section 3. Classes and Instances:

"Structures can have any number of slots, from zero up (to some
implementation-defined limit, e.g. 254 in LispWorks for Windows) and -
as with lists and general vectors - the slots can hold any values."


but I don't know whether it applies to classes in CLOS per se, even
though they are technically structures.

But anyway, this may be a superfluous detail that doesn't help me
solve a problem as to why a class I created cannot even handle 8 slots
let alone 254.