[plt-scheme] javascript s-exp transform

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Wed May 30 17:40:33 EDT 2007

You have the power.

If you use the prototype-web-server
(web-server/prototype-web-server/servlets/add.ss as an example), it
will do the continuation serialization process on your whole program,
including the parts of your program that construct javascript. [Btw,
Dave Herman's javascript.plt is better than mine.] So,

(let/cc k
 (js ,(write/string (serialize k))))

will be Javascript syntax for a string representing your continuation,
serialized.

Jay

On 5/30/07, kanishka <nish2575 at yahoo.com> wrote:
> Jay,
>
> Given these previous discussions ...
>
> >> my ideal continuation style web app would define two co-routines, a
> >> scheme
> >> routine, and a javascript routine, and pass the continuation back
> and
> >> forth, with no continuations actually stored on the server. it would
> >> also allow for the javascript routine to branch to different
> >> continuations (or pick another partner for its coroutine dance),
> >> similar to what send/suspend/dispatch allows you to do.
>
> >> kanishka
> .............
>
> On 5/24/07, Shriram Krishnamurthi <sk at ...> wrote:
> > I'm afraid there is no "simple method" other than what is described
> in
> > that paper.  If, however, you want to try a different approach that
> > perhaps feels a bit less complicated, you could consider our other
> > approach to doing this, which does not use CPS at all:
> >
> >
> http://www.cs.brown.edu/~sk/Publications/Papers/Published/pcmkf-cont-from-gen-stack-insp/
>
> BTW, This is implemented in the `prototype-web-server' in the SVN
> graveyard. Also, it will be re-integrated into the mainline server in
> SVN in the coming weeks.
>
> Jay
>
> .................
>
>
>
>
> Would you be willing to implement an experimental version of either cps
> or continuation-mark version of automated program transformation on top
> of the javascript s-exp syntax (from planet)? Possibly add it as helper
> library to the plt server.
>
> example input:
>
> (define jscode
>   (js
>     (TRANSFORM
>      (define (precpsfunc action)
>        (if (form-updated? action)
>            (define result (validate action))
>            (if (warning? result)
>                (update-message-area! result))
>                (resp (K-POINT (post-to-server action)))
> ...
> )
>
> if using the cps version, output could be a javscript table of
> closures..
>
> kanishka
>
>
>
> ____________________________________________________________________________________Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
> http://farechase.yahoo.com/
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


-- 
Jay McCarthy <jay.mccarthy at gmail.com>
http://jay.teammccarthy.org


Posted on the users mailing list.