gets evaluated when the class is instantiated. thus i always have to check the ephemeral against NIL. is there a way to avoid evaluating the drift body on class instantiation? the drift cell has a initial value anyway...
Code: Select all
(cells-reset) (defmodel drifter () ((drift :cell :ephemeral :initform (c-formula (:inputp T :lazy :until-asked) (break "asked") NIL) :accessor drift-of) (val :initarg :val :accessor val-of)) (:default-initargs ; if you remove this whole block then (break "asked") won't be called :val (c... (50) (if (null (^drift-of)) ; how do avoid this??? (progn (format T "~&initial drift?") 1) (let ((d (- 50 (random (^drift-of))))) (format T "~&drift: ~S" d) d))))) (defparameter drifter1 (make-instance 'drifter)) (val-of drifter1) (setf (drift-of drifter1) 100) (val-of drifter1)
i also tried to make the ephemeral cell lazy but it is asked as soon as the drifter cell is initialized.