Peter Denno wrote:
On Saturday 05 March 2005 10:24, Kenny Tilton wrote:
Yes. There is an :unchanged-if option (default EQL (supplied by Cells internals)) on slot definitions in DEFMODEL:
Example from Cello: (defmodel image (ogl-node model) ((clipped :cell nil :initarg :clipped :initform nil :reader clipped) (inset :initarg :inset :unchanged-if 'v2=
I would have thought that :unchanged-if would take a function of one value. Are you saying here that it still uses EQL, but instead of checking against old-value #'(lambda (x) (eql old-value new-value)) it is doing #'(lambda (x) (eql new-value 'v2=)) ?
A function of one value? No, the question is whether the prior value calculated by a rule is the same as the latest value calculated because some dependency changed. The prototype would be:
(defun custom-change-test (latest-value prior-value)....
Here is the relevant code, massively edited/simplified here to make the flow apparent:
(defmethod md-slot-value-assume (c raw-value) (let ((prior-state (c-value-state c)) (prior-value (c-value c)) (absorbed-value (c-absorb-value c raw-value)))
(unless (and (eql prior-state :valid) (c-no-news c absorbed-value prior-value)) (setf (c-changed c) t) (c-propagate c prior-value (not (eql :unbound prior-state)))))
absorbed-value)))
;----------------- change detection ---------------------------------
(defun c-no-news (c new-value old-value) (bif (test (c-unchanged-test (c-model c) (c-slot-name c))) (funcall test new-value old-value) (eql new-value old-value)))
kt