[cells-devel] Handling not-to-be'd kids and how to do an input slot for kids

Peter Hildebrandt peter.hildebrandt at gmail.com
Fri Apr 11 18:00:19 UTC 2008


Ken,

as discussed in the ECLM thread:

>  I look forward to the IR, maybe you have run into something I want to add
> to Cells to better handle things going away (a frequent problem). In my
> latest app I am running into a lot of problems with what is generally called
> referential integrity, specifically external references to kids that have
> been not-to-be'd. eg, my window's keep a reference to the "focus", which
> might be in a math problem the student decides to delete.  uh-oh. Sprinkling
> (setf (focus w) nil) all over the place broke down when it ended up erasing
> a new value that had been set by code that tried to handle the problem by,
> say, moving the focus to the next problem when deleting the current problem.

What happens in my case is that I have one family observing another like

(defmodel observer (family)
  ()
  (:default-initargs :kids (kids-list? (loop for kid in (kids (value
self)) collecting (make-instance 'observer :value kid :fm-parent
*parent*)))))

Then, when we remove a kid in the observed tree, its kids are declared
md-dead *before* the observers on those are disposed of, and
immediately cells complains about accessing a dead cell.

I am at a loss here, so any insight is greatly appreciated.

My second question sounds really simple:  I want to define a list of
kids in an input slot, like

(make-instance 'node :kids (c-in (list (make-instance 'node))))

Obviously I am missing the :fm-parent initarg here, so it won't work.
But:  How do I get the :fm-parent properly assigned for a (c-in
initform)?

Thanks,
Peter



More information about the cells-devel mailing list