4 ms·
JavaScript is the only thing that you can really run on any semi-modern device. TVs, phones, laptops, desktops, servers, the only thing you can expect to execut
by cookiecaper 7y ago
JavaScript is the only thing that you can really run on any semi-modern device. TVs, phones, laptops, desktops, servers, the only thing you can expect to execute on all of them is JavaScript. If you write your core libraries in JavaScript, you'll have that much less to worry about re-implementing and maintaining in something else. You'll have flexibility to potentially execute the same code on either client or server, phone or desktop. There are situations where that's pretty useful.
More than that, at least last time I checked, V8 is really fast. It is many times faster than the usable Python implementations, or practically any other memory-managed runtime. Only luajit seemed to sit in the same ballpark when I pulled up the shoot-out a couple years back.
I personally hate all of these facts, but sometimes, they really do mean that prioritizing JavaScript, or at least something that compiles down to JavaScript, is the best choice.
- saagarjha 7y ago> JavaScript is the only thing that you can really run on any semi-modern device. Wait, hold on: you can usually run C on most devices.
- Moru 7y agoThe difference is that C needs to be compiled to run on anything, javascript does not.
- saagarjha 7y agoRight, but JavaScript needs a runtime to work at all. And I don't think there was any requirement that the language couldn't be compiled?
- GoblinSlayer 7y agoIt's not like you seriously want to run C without a runtime.
- saagarjha 7y agoMany people do in fact do this, often for embedded systems. And most other systems happen to ship with a C runtime.
- pjmlp 7y agoThere are C interpreters, commercial and open source since the mid-90's, don't mix languages with implementations.
- cookiecaper 7y agoGenerally true, but we both know that it's not so simple, and I'm surprised HN took this bait so readily. With JS, you have to worry way less about hardware-specific builds, platform-specific linking implications, differing system behavior and intrinsics, or any of the other substantial hangups that become relevant when you need to distribute a native application across a wide range of devices. We don't need to repeat the rest of the thread where everyone hops in and says "tut tut, hypothetically, it would be possible for it to not be that way". We're talking about the way things actually are. In an ideal world, JS would've been out of the picture about 3 years after it was born. :)