[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swindle Question



On Jul  9, Alex Peake wrote:
> A question about initialization of a class object:
> 
> Here is a simple example:
> 
> (defclass <attribute> ()
>   (name :initarg :name :accessor name)
>   (domain :initarg :domain :accessor domain)
>   (dom-len :initarg :dom-len :accessor dom-len)
>   (nullable :initarg :nullable :initvalue #f :reader nullable? :writer
> set-nullable!)
>   (pk :initarg :pk :initvalue #f :reader pk? :writer set-pk!)
>   (pk-pos :initarg :pk-pos :accessor pk-pos))
> 
> (define client-attr (make <attribute> :name "Client" :domain "integer"
> :pk-pos 1))
> 
> Is there a way to set the pk slot to #t if the pk-pos slot is set (to
> anything)?

Yes, but the most obvious way is to use the MOP.  If all you need is
simple structures, then I think that CLOS is an overkill...

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!