Chris Nandor wrote:
At 22:52 +0100 2006.05.29, Dominic Mitchell wrote:
JavaScript -- the new respectable face of the web. Until you want to do
anything with it outside of a browser. There's apparently lots of choice:
* Rhino -- except that loading a full JVM to run a few lines of
JavaScript code is living using a JCB to swat a fly.
* SpiderMonkey -- Mozilla's JavaScript engine, ripped out and zombie-like.
* njs -- so dormant it's like Rip van Winkle.
* WSH -- yep, that'll work really well on my mac.
All I wanted to do was run JSLint at the command line. Surely it can't
be that hard? Yet SpiderMonkey has no I/O capabilities at all. Rhino
has ReadFile(), but it's Java and slow. njs couldn't even parse the
bloody jslint source, let alone try providing some input to it.
That's OK, I'll work around this by using JavaScript::SpiderMonkey and a
small bit of Perl. Except that appears to hang completely when run
against the simplest function(). What a steaming pile of donkey turds.
[pu...@bourque js]$ cd /usr/local/src/js/src/Darwin_DBG.OBJ
[pu...@bourque js]$ cat > test.js
var x = { a: 1, b: 26 };
print(x.b + x.a);
[pu...@bourque js]$ ./js test.js
27
[pu...@bourque js]$ ./js
js> var x = { a: 1, b: 26 };
js> x.b + x.a;
27
Dunno if this helps you ... but I was able to compile SpiderMonkey for Mac
and run it on the command line without much difficulty.
Spidermonkey works fine on it's own. It's trying to access it via the
Perl bindings that breaks so badly. Why should I care about that?
Because I want to do something more useful than the built in extremely
limited environment allows (I/O).
-Dom