Fwd: [bknr-devel] :read :update keywords meaning

Hans Hübner hans at huebner.org
Mon Nov 6 14:55:25 UTC 2006


(forgot to Cc to the list)

---------- Forwarded message ----------
From: Hans Hübner <hans at huebner.org>
Date: 06.11.2006 14:24
Subject: Re: [bknr-devel] :read :update keywords meaning
To: Kamen TOMOV <kamen at cybuild.com>


Hi Kamen,

:read means that a slot reader method is automatically defined,
:update means that a reader and a writer method is defined.

If you have a class

(define-persistent-class foo ()
 ((slot-a :read)
  (slot-b :update)))

then macroexpanding this will yield:

(defclass foo (store-object)
 ((slot-a :reader foo-slot-a :initarg :slot-a)
  (slot-b :accessor foo-slot-b :initarg :slot-b))
 (:metaclass persistent-class))

Thus, :read gives you a :reader method whereas :update yields an
:accessor.  Both create a :initarg so that you can initialize the
slots in a make-object.  Note that nothing prevents you from writing
to a :read slot using change-slot-values or setf.

C-c C-m in slime macroexpands a s-expression, which is pretty handy.

Cheers,
-Hans

2006/11/6, Kamen TOMOV <kamen at cybuild.com>:
> Hi,
>
> I tried to find in the documentation the meaning of the :read and
> :update slot options in define-persistent-class and I couldn't. Then I
> tried in the source and got lost :-)
>
> Could you please help? Thanks!
>
> --
> Kamen
> _______________________________________________
> bknr-devel mailing list
> bknr-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/bknr-devel
>



More information about the Bknr-devel mailing list