In article <····························@4ax.com>, Ahmed Magdub <.> wrote:
>I would appreciate any help on this.
>I am trying to do something like this
>
>( defclass screen ()
> ( ht :initform 20 :initarg :ht :accessor ht)
> ( wd :initform 40 :initarg :wd :accessor wd)
> ( screen-array :initform (make-array '( ht wd) :initarg :accessor
>screen-array )))
First of all, even if what you were trying to do could work, the syntax
would be:
:initform (make-array (list ht wd))
Array dimensions must be a list of fixnums, but '(ht wd) evaluates to a
list of symbols.
However, slot names are not variables, so you can't do that (the only time
slot names can be used like variables is within a WITH-SLOTS form).
What you need to use is a SHARED-INITIALIZE :AFTER method. By the time
this runs, all the slots will have been initialized using the standard
mechanism, and it can fill in other slots that depend on them.
--
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.