5 ms·
Umm...are there any reasons, other than the JVM, to use Java? I'd much rather write plain old JS (or even better, CoffeeScript) than Java any day.
by endtime 16y ago
Umm...are there any reasons, other than the JVM, to use Java? I'd much rather write plain old JS (or even better, CoffeeScript) than Java any day.
- samstokes 16y agoVast quantities of existing code?
- technomancy 16y agoHe said other than the JVM.
- cemerick 16y agoIf we're talking about a JVM impl (rather than a source-to-source compiler á la GWT), being able to use better languages like Clojure, Python (via Jython), Ruby (via JRuby), et al. would be a huge reason.
- vhackish 16y agoHmmm, I'd assumed it was a source-to-source compiler. Are they thinking of writing a JVM in JavaScript? Can you say slow? And debugging seems like a nightmare. And if it's not that, then how else does it get into the browser?
- cemerick 16y agoPresumably, that's what Orto did (a post about which I linked to in the original post), and apparently with reasonable performance results for the examples they provided at the time (circa 2008). Javascript runtimes are becoming absurdly fast these days, so I wouldn't put an efficient and effective JVM-in-Javascript out of reach on spec, at least not yet.
- endtime 16y agoFair enough. Though if you want to write code that looks like Python or Ruby, I can't recommend CoffeeScript (or Coco, if you're feeling frisky) enough.
- Locke1689 16y agoI don't know but this trend of making Javascript a compilation target is making me want to shoot myself (from a compiler-design perspective). JVM->Javascript seems like they're begging me to head over to Oracle and scream "Guys! You're going the WRONG WAY!"
- cemerick 16y agoJavascript's absolutely ubiquitous distribution characteristics have resulted in all sorts of irrational behaviour. If the W3C or the browser makers collectively had put some thought into making it possible for other languages to be linked into the client in a sane way (i.e. rather than the existing plugin regime), or defined some proper IL that app authors could compile to, Javascript wouldn't be on its way to being the compilation target for the web.
- azakai 16y agoYou make it sound like they were incompetent, lazy or evil. Or perhaps I misunderstood you, sorry if so. But the fact is, they did think a lot about using other languages on the web, and about proper ILs as well. The fact is, there has been no good way to do either, if you want a standards-based platform with multiple compatible implementations. You can take some existing IL like Java bytecode, but (1) that stuff is patented, and (2) there is no hope of cross-vendor agreement on what that IL should be, and all of them have various issues anyhow (for example, Java and .NET bytecode were designed with static languages in mind). JavaScript is winning simply because it's there, it works, and everybody supports it. Yes, it has frustrating limitations, but it's hard to see a practical alternative. We will simply need to overcome those limitations - and that is possible.
- cemerick 16y agoThat was perhaps a little harsh in the phrasing; I wasn't really implying any of those things. I think I am saying that this appears to have been a blind spot on the part of the web standardization crowd and the browser makers. Maybe I'm entirely wrong though, and there were efforts that simply hit hard problems, as you say. I'd never heard of any discussions around determining a proper IL, though; if you can, a link so relevant MLs and such would be most appreciated.
- vhackish 16y agoYeah that just seems silly. But of course that's the Java way: add layers of abstraction wherever possible. Oh, and a big abstract IDE on top of it all would be really helpful ;-)
- azakai 16y ago> Umm...are there any reasons, other than the JVM, to use Java? I'd much rather write plain old JS (or even better, CoffeeScript) than Java any day. Existing code. I agree that writing JavaScript is better in almost all cases, but there is a lot of existing code out there and not just in Java but C, C++, and other languages. Being able to run that on the web, anywhere, would be huge.
- rbanffy 16y agoIn my book, Java is the best reason not to use a JVM. It's things like Jython and Clojure that save it.
- endtime 16y agoI agree; I implied that the JVM is a reason to use Java, not that Java is a reason to use the JVM.