[parenscript-devel] Sharing code between client and server?
vsedach at gmail.com
Wed Feb 3 10:22:31 UTC 2010
> What is the best way to share code between client and server?
In practice mostly through macros
with defmacro+ps and import-macros-from-lisp. You can also keep around
pieces of code that you would COMPILE (CL) and PS-COMPILE, but I've
never actually had to do that in my projects.
> - Do I use the Parenscript constructs on the server? Not having CLOS
> seems a shame.
You need to hide any CL-but-not-PS functionality under macros. Red
Daly's Suave project (http://common-lisp.net/project/suave/) includes
a CLOS for Parenscript though.
> - How would one send objects between client and server?
> - As JSON? How would the conversion be performed?
JSON is easiest. There's a couple of CL JSON libraries
http://marijn.haverbeke.nl/st-json/). You can use Parenscript for
generating JSON, but since it mostly does "the wrong thing" when you
just give it data, it's easier to put something together specific to
your JSON schema (which IMO should be used as an interface instead of
a dumb serialization format anyway) using SYMBOL-TO-JS-STRING.
> Axel Rauschmayer
> axel at rauschma.de
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
More information about the parenscript-devel