Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what Javascript implementations for .net exist?

This is a question with its own answer, probably destined for cw

Firstly - what are the characteristics of a good JS implementation (in my view)

  • complete. It must be able to handle all JS constructs. Good tests are to see if it can compile things like jquery, prototype, underscore etc (of course many of these wont execute since they need a DOM)
  • stable. No crashes, or sometimes works, sometimes doesnt
  • Fast
  • Silverlight support
  • Nicely embeddable. I want simple interface between the hosting environment and the JS and back again. It should Just Work
like image 879
pm100 Avatar asked Sep 07 '11 17:09

pm100


1 Answers

I know several implementations

  • Ironjs https://github.com/fholm/IronJS
  • Jurrasic http://jurassic.codeplex.com/
  • Jint http://jint.codeplex.com/
  • Javascript.net https://github.com/JavascriptNet/Javascript.Net

Ironjs. Firstly this is pure F#!. Its the first real word large scale thing I have seen done in F# and as such is a real eye-opener. Even if you are not interested in javascript its a great learning tool for F#. How does it score:

  • complete: Yes
  • stable: Yes
  • Fast: claims to be very fast, I have not measured. Its an interpreter
  • SL : No (an open work itme for it on github)
  • Embed: Hard work to pass thigns back and forth. No access to .net libs from JS code

Jurassic. This says that it compiles to IL, ie no interpretation

  • complete: Seems so
  • stable. Cant say, not tested enough
  • Fast. Claims to be because its not an interpreter. However the fact that it compiles to IL strongly suggests that it will leak code space. Ie a server running different scripts will eventually fill up.
    • SL: Yes
  • Embed: Looks about the same as IronJS.

Jint. This is an Antlr front ended interpreter (interesting to note that ironjs used to use antlr but gave up and did its own parsing for perf reasons and seemed to get a huge boost)

  • Complete: I found a few things missing, they got fixed but it was a little worrying
  • Stable: A few wobbly places
  • Fast: Acceptable
  • SL: No
  • Embed: Really nice. It Just Works. I can instantiate .net classes right in the JS. I can freely pass data back and forth.

Javascript.Net. This is a managed wrap of google's V8 engine. I have not tried it at all so can only say whats on the web site

  • Complete: ?
  • Stable: ?
  • Fast: I expect it to be fast given how fast V8 is
  • SL: no
  • Embed: ?

I ended-up using Jint because it had such nice embedding capabilities, but I really need SL support (I have two projects that need embedded JS, the second one is a SL project) and I don't want to use 2 different engines, so something will have to change change

Anybody any experiences or other implementations?

like image 142
pm100 Avatar answered Sep 25 '22 05:09

pm100