[cells-gtk-devel] Re: [cells-devel] Newbie questions

Kenny Tilton ktilton at nyc.rr.com
Sat Mar 5 17:14:19 UTC 2005



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

-- 
Cells? Cello? Cells-Gtk?: http://www.common-lisp.net/project/cells/
Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film

"Doctor, I wrestled with reality for forty years, and I am happy to state that I finally won out over it." -- Elwood P. Dowd





More information about the cells-gtk-devel mailing list