Ruby and Java Running in JavaScript 220
John Resig is reporting on his blog that a recent trip to Tokyo opened up some very interesting JavaScript projects to him that haven't met with widespread popularity outside of Japan yet. "One project, in particular, really caught my eye. It's called Orto and is an implementation of the Java Virtual Machine (JVM) in JavaScript. This means that you can take an existing Java application, compile it to bytecode, run it through Orto (which produces the JavaScript, and embed it in a web page. While it doesn't provide the full capabilities of most Java code it does provide enough to make for some interesting demos." In a separate post he also detailed how the HotRuby project is allowing a Ruby VM to run in a browser using JavaScript or even indirectly using ActionScript in Flash.
But... (Score:5, Interesting)
Does it run Linux? ;)
In all seriousness, though... I'm struggling to see how this is truly beneficial. Aren't most pages already hopelessly clogged with mounds of JavaScript? Is it that difficult to expect a user to have a Java interpreter already installed when they visit the page such that having your Java "emulated" in JavsScript is the better solution?
Just seems like a solution needing a problem to me.
Re:Doing things the slow way (Score:3, Interesting)
I'm with you, I read the summary and almost choked on my coffee.
This is like writing a Cray emulator for your TI 99/4a -- I don't know what it buys you.
I'm sure some clever person will put out a demo showing something completely amazing, and I'd love to see it. For now, it sounds like "because we can" sorta stuff (not that there's anything wrong with that).
Cheers
Google Web Toolkit (Score:5, Interesting)
Strange (Score:5, Interesting)
Why does everyone hate Javascript so? If you're going of cut-n-paste examples from the web yes it looks like an ugly language. Check out how the OO stuff works, or some JQuery code, and you'll be pleasantly surprised.
Re:Awesome! (Score:3, Interesting)
Cynicism was my initial response as well, but reading TFA shows a pretty cool demo [accelart.jp]. The fact that they are able to convert Java's user input events, GUI, and multithreading to Javascript is pretty cool. Probably has no practical use, but still cool.
If nothing else it means that the next time (in about 3 minutes if today is a normal day) somebody gets Java and Javascript confused, I can say they really ARE "basically the same thing" now!
Re:Doing things the slow way (Score:3, Interesting)
Why wouldn't I code in Java? For most things I code, I see about a 10-20% performance penalty vs C, plus a modest load time (that I don't care about usually). I also see a noticeably reduced development time; for me that's a trade worth making under most circumstances. Now, I'm not coding user interfaces, and I am paying attention to performance of my Java code (unlike many Java developers). I'm also emphatically not claiming it's a good environment for everything (but I'd say the same about any language / platform). For what I do, it does a good job of balancing speed and ease of development and a number of other things.
If you'd like to claim that Java is universally slow, I have a program spec you're welcome to implement in the language of your choice for comparison. I'll warn you, though, the last time someone implemented it in C++ it came out slower (though once I pointed out the subtle algorithmic difference between our implementations, the C++ won by 10-20%).
Re:Language stacks galore! (Score:3, Interesting)