dyoo / whalesong

Whalesong: Racket to JavaScript compiler
http://hashcollision.org/whalesong
250 stars 30 forks source link

Add js-eval for evaluating Javascript from Whalesong #89

Closed soegaard closed 12 years ago

soegaard commented 12 years ago

This adds js-eval which evaluates a piece of Javascript form Whalesong (in strict mode). There is an example in examples/raphael-demo.rkt . The example contains bindings for the graphics library Raphael from raphaeljs.com.

dyoo commented 12 years ago

On Mon, Feb 27, 2012 at 5:26 PM, Jens Axel Søgaard reply@reply.github.com wrote:

This adds js-eval which evaluates a piece of Javascript form Whalesong (in strict mode). There is an example in examples/raphael-demo.rkt . The example contains bindings for the graphics library Raphael from raphaeljs.com.

Awesome! Ok, so I've added a load-script to the FFI to make it easy to dynamically include other JS urls, so we don't need to use "--include-script" as much. See:

https://github.com/dyoo/whalesong/commit/d41aa187e3515a20d2f3922732b7553fc86bfee9

dyoo commented 12 years ago

Awesome!  Ok, so I've added a load-script to the FFI to make it easy to dynamically include other JS urls, so we don't need to use "--include-script" as much.  See: https://github.com/dyoo/whalesong/commit/d41aa187e3515a20d2f3922732b7553fc86bfee9

Hi Jens,

I traced what was making the example run slowly as time progressed: web-world eagerly copied the structure of the dom, regardless if the program uses it or not on each world updater or to-draw. I've added a little bit of laziness to my web-world library,

https://github.com/dyoo/whalesong/commit/8df8168d1c935a3f31aebb12a6b819d9ae3d3aa6

and now your raphael-demo runs a lot more smoothly.

soegaard commented 12 years ago

Danny wrote:

Awesome! Ok, so I've added a load-script to the FFI to make it easy to dynamically include other JS urls, so we don't need to use "--include-script" as much. See:

https://github.com/dyoo/whalesong/commit/d41aa187e3515a20d2f3922732b7553fc86bfee9

Great. That's very convenient.

/Jens Axel

soegaard commented 12 years ago

2012/2/28 Danny Yoo < reply@reply.github.com

Awesome! Ok, so I've added a load-script to the FFI to make it easy to dynamically include other JS urls, so we don't need to use "--include-script" as much. See:

https://github.com/dyoo/whalesong/commit/d41aa187e3515a20d2f3922732b7553fc86bfee9

Hi Jens,

I traced what was making the example run slowly as time progressed: web-world eagerly copied the structure of the dom, regardless if the program uses it or not on each world updater or to-draw. I've added a little bit of laziness to my web-world library,

https://github.com/dyoo/whalesong/commit/8df8168d1c935a3f31aebb12a6b819d9ae3d3aa6

and now your raphael-demo runs a lot more smoothly.

Cool. I had a rotating rectangle example, which exhibited strange unexpected non-constant rotation speed - but was worried the bug were a GC bug in the bindings.

/Jens Axel