[parenscript-devel] Miscellaneous utils I use

Vladimir Sedach vsedach at gmail.com
Tue Jun 19 19:47:34 UTC 2007


Excellent suggestions John! I've forgotten about it, but it turns out
we were doing min and max ourselves in the project that I'm using
ParenScript for. I've put the JS math functions and a macro called
with-timeout into a new file, js-utils.lisp, and pushed everything out
to the ParenScript darcs repository.

One thing I didn't include is make-xml-http-request. I think that
anything that is conditional on browser versions should be kept out of
ParenScript itself, both to help prevent future bit rot, and because
run-time browser detection is not the only (nor the best) way to
handle browser differences (for example, on my project, we're planning
to include different scripts based on the value of the agent HTTP
header field - obviously this will not work for everyone, but the
run-time approach does not work for us, so I think this is really an
issue best left to applications or libraries built on top of
ParenScript).

Thanks,
Vladimir

On 6/19/07, John Fremlin <john at fremlin.org> wrote:
> (defjsmacro max (a b)
>   `(*Math.max ,a ,b)) ; might be nice to be able to have more than two arguments
>
> (defjsmacro ceil (expr)
>   `(*Math.ceil ,expr))
>
> (define-js-compiler-macro timeout (form timeout)
>   (js-compile `(set-timeout (lambda() ,form) ,timeout)))
>
> (defjsmacro make-xml-http-request ()
>   `(if (slot-value window '*X-M-L-Http-Request )
>        (new *X-M-L-Http-Request)
>        (new (*Active-X-Object "Microsoft.XMLHTTP"))))
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>



More information about the parenscript-devel mailing list