[Bese-devel] Backtracking question

William Halliburton whalliburton at gmail.com
Fri Aug 5 21:51:09 UTC 2005


Hello. I am trying to get the hang of the backtracking.

I have a test component:

(defcomponent backtest (widget-component)
  ((val1 :backtrack t :initform nil :initarg :val1 :accessor backtest.val1)
   (val2 :backtrack #'copy-seq :initform '(nil) :initarg :val2
:accessor backtest.val2)))
   
(defaction backtest-toggle-1 ((backtest backtest))
  (setf (backtest.val1 backtest) (not (backtest.val1 backtest))))

(defaction backtest-toggle-2 ((backtest backtest))
  (setf (car (backtest.val2 backtest)) (not (car (backtest.val2 backtest)))))

(defmethod render-on ((res response) (backtest backtest))
  (<ucw:a :action (backtest-toggle-1 backtest) (<:as-html
(backtest.val1 backtest)))
  (<:as-is " ")
  (<ucw:a :action (backtest-toggle-2 backtest) (<:as-html (car
(backtest.val2 backtest)))))

Val1 works as expected. I can toggle it and it will not affect other
frames that have forked. Val2, on the other hand, does not work as
exprected. Toggling and then reloading the page will toggle again,
also forking the page and toggleing on one page will set the value in
all instances. I replaced copy-seq with my own function for copying
and it looks like it is never called. I am assuming that I have a
misunderstanding about how the backtracking works.

Does anyone have a good explanation on the backtracking and how to fix
this code.

Thank you,
William Halliburton



More information about the bese-devel mailing list