[Bese-devel] Re: forcing a client refresh

hbabcockos1 at mac.com hbabcockos1 at mac.com
Mon May 29 00:06:24 UTC 2006


On May 26, 2006, at 7:07 AM, Marco Baringer wrote:
>
> an 'action' is a cc method (something defined with defmethod/cc
> (defaction is a wrapper around defmethod/cc)). cc methods, when called
> normally, return another function, which must be called again until a
> DONE tag is thrown. the with-call/cc macro known this and handles it
> properly, you'll notice that the <ucw tags (see
> src/yaclml/ucw-tags.lisp) all use action-href like this:
>
> `(action-href (lambda () (with-call/cc ,action)))
>
> which is the only thing your code is missing:
>
> (defun timed-function-call (delay-in-ms function argument)
>   (let ((href (concatenate 'string "location.href='"
> 			   (action-href (lambda ()
>                                           (with-call/cc
>                                             (funcall function  
> argument))))
> 			   "'")))
>     (<ucw:script `(setf window.onload
> 		   (set-timeout ,href ,delay-in-ms)))))
>
> now you can pass an action to timed-function-call, with-call/cc knows
> how to handle normal (non /cc) functions as well so this change should
> add functionatily while still allowing you to use it as before.

Thanks for the help! I think that you have to re-write this as a  
macro to use it with actions & with-call/cc, which makes it a little  
cleaner anyway since you don't need one (or more) argument parameters.

(defmacro timed-function-call (delay-in-ms function-call)
   (let ((g0 (gensym)))
     `(let ((,g0 (concatenate 'string "location.href='"
			     (action-href (lambda ()
					    (arnesi:with-call/cc
					      ,function-call)))
			     "'")))
       (<ucw:script (list 'setf 'window.onload
		    (list 'set-timeout ,g0 ,delay-in-ms))))))

-Hazen




More information about the bese-devel mailing list