[cells-devel] How does cells deal with in-place modification of slot values?

Peter Hildebrandt peter.hildebrandt at gmail.com
Mon May 19 07:56:33 UTC 2008


On Sun, May 18, 2008 at 10:17 PM, Larry Clapp <larry at theclapp.org> wrote:
> Do I need to wrap perturb-test too?  e.g.
>
>  (defmodel test ()
>    ((a :initarg :a :initform (c-in (list 'a)) :accessor a)
>     (a-changed :initform (c-in 0) :accessor a-changed)
>     (b :initarg :b :initform (c? (and (^a-changed) (car (^a)))) :accessor b)))

...

>  (defun perturb-test (self y)
>    (prog1
>        (setf (car (^a)) y)
>      (incf (^a-changed))))

Interesting side note:  This is exactly how the cells-store (the
cellsy hash table) works.  If you can live with the hackish nature of
it, it will probably work fine.

If you have access to the way some-other-package is compiled, you
could try and shadow car/cdr so that they trigger an appropriate
update.

Peter



More information about the cells-devel mailing list