4 ms·
Mug: A New JavaScript compiler for the JVM
- onteria 16y agoWhy is all the content flushed to the right? It's making it hard to read the content and actually get a sense for what Mug is all about.
- pohl 16y agoSeriously? There's only 4 paragraphs total. How hard can it be? It's strange that it would make it hard to read. Typographic manuals usually suggest roughly 60 characters per line, favoring narrow columns over wide columns.
- onteria 16y agoYes seriously? I open the page and immediately the main content is this person's contact information. "What's this have to do with the main topic?". Oh wait it's all the way over on the right. Guess where most people avoid looking at: http://www.squidoo.com/heat-map http://www.squidoo.com/heat-map Because that's where most ads are. It's not about the amount of content, it's about putting it in the right place.
- al_james 16y agoThis is very exciting. Will be interesting to benchmark and see what the performance is like. It would be great if you dynamically compile JS to java classes at runtime (store procedures in JS etc).
- CoffeeDregs 16y agoAwesome. Question: I was under the impression (perhaps mistakenly) that it would be impossible (or very hard) to statically compile a highly dynamic language like Javascript. Yes, No? Are there shortcuts Mug takes or disallowed coding styles? How would Mug handle the following RuPyScript pseudocode: for i in 1..10; eval "def function$i; print 'I'm $i'; end"; end
- stingraycharles 16y agoI think, by definition, eval () will be impossible in a statically compiled environment.
- CoffeeDregs 16y agoRight, right, but then how useful would Mug be if the dynamic stuff in JS can't be used?
- JonnieCache 16y agoMunging strings and then eval()ing them is the worst way to write dynamic code. Hopefully its not common in most js libraries. Missing eval() is a feature.
- latortuga 16y agoAs a follow up in case anyone is curious about the why behind this assertion, consider a line of code like this eval("myObject."+functionName+"()") Not only does it make it difficult to track down the calls to this method, it is now impossible to minify this chunk of code, something that is very commonly done in javascript. This is why javascript includes things like apply() and accessing members of an object in multiple ways (obj.attribute == obj['attribute'], for user-defined values of attribute).
- deleted 16y ago[deleted]
- phuff 16y agoThe "dynamic stuff" appears to all be included. Just not eval(), which is probably a bad thing for most JS code anyway...
- timcameronryan 16y agoRight. Technically Mug will conform to the ECMAScript 3 Compact Profile: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-327.pdf http://www.ecma-international.org/publications/files/ECMA-ST... Which doesn't include eval() or the with(){} statement (both used infrequently enough that it's not worth the overhead). A REPL would still be possible, however, it would require some work to maintain the current scope between input.
- bokchoi 16y agoIsn't Oracle also working on a new JS implementation on the JVM? I saw a job posting a while back. Found it: http://robilad.livejournal.com/71787.html http://robilad.livejournal.com/71787.html
- tlrobinson 16y agoInteresting benchmark idea: run JavaScript benchmark suites through Mug then GWT, compare to original.
- pjscott 16y agoI'm guessing that Mug produces bytecode very different from that which you would normally want to run through GWT, and therefore might not be a very representative benchmark.
- marijn 16y agoPro tip: Go straight for ECMAScript 5, don't waste your time on 3. With CL-JavaScript (http://marijnhaverbeke.nl/cl-javascript http://marijnhaverbeke.nl/cl-javascript) we also thought 3 would be easier, but now we regret our decision: - The ECMA5 document is (slightly) easier to read. - Most 'extra' ECMA5 features can be added later, piecemeal, so initial development doesn't have to be more complicated. - People will want ECMA5 eventually anyway. - It is a waste of time to work through two ugly standards when one would have sufficed.