Ken,
First of all, thanks for the quick fix. However, it does not behave quite as it should: cell slots now return t during not-to-be. I think the reason is in md-slot-value.lisp:ensure-value-is-current, more exactly:
(when *not-to-be* (return-from ensure-value-is-current t))
While the function returns otherwise:
(bwhen (v (c-value c)) (if (mdead v) (progn #+shhh (format t "~&on pulse ~a ensure-value still got and still not returning ~a dead value ~a" *data-pulse-id* c v) nil) v)))
That is, (c-value c).
I changed it accordingly:
(when *not-to-be* (return-from ensure-value-is-current (c-value c)))
Which works fine with my example code (that is, the cells-tree-view). I checked it into cvs.
I am not quite sure about the implications, though. I think what I am doing here is return the value of a cell without recalculating it -- That is, I get the value calculated the last time the cell was accessed alive. That means -- if I am right -- the value I work on might be quite old, and a more granular check of the *not-to-be* special might be appropriate.
However, I did a quick test:
;; make two nodes to create a cell dependency CTEST> (defparameter *val* (make-instance 'node :value (c-in 1))) *VAL* CTEST> (defparameter *root* (make-instance 'node :kids (c?n (list (make-kid 'node :value (c? (value *val*))))))) *ROOT*
;; check whether it works CTEST> (value (first (kids *root*))) 1 CTEST> (setf (value *val*) 2) 2 CTEST> (value (first (kids *root*))) 2 ;; yep
;; look at not-to-be, CTEST> (defmethod not-to-be :before ((self node)) (trc "not-to-be :before" (value self))) #<STANDARD-METHOD NOT-TO-BE :BEFORE (NODE) {CEFE609}>
;; make a change CTEST> (setf (value *val*) 3) 3
;; and see ... CTEST> (setf (kids *root*) nil) 0> not-to-be :before 3 0> not-to-be :before 3 NIL ;; wonderful!
So maybe that's it :-)
Cheers, Peter
On Sun, Apr 13, 2008 at 12:57 AM, Ken Tilton kennytilton@optonline.net wrote:
fixes...
To sum up, I believe the problem is that at a change of the kids list
- First the kids are declared dead
- Then not-to-be is called recursively
and thus not-to-be is passed a dead self.
Yeah, I ran into this once in an observer.
Sorry, meant to say "in a not-to-be".
Anyway, let me implement *dead-is-cool* and have that bound to t before
calling not-to-be so there is no need to wrap not-to-be code at all and see what happens. I'll commit something soon, lemme know if it works. :)
Done. The special is *not-to-be*.
Cells regression test passes but did not exercise any tests of mortality.
kt