5 ms·
Ask HN: Is JavaScript's Time Up?
The title is immediately deceiving, but I couldn't think of better wording for a title. Specifically, I mean to ask if Javascript as a language front-end (as compared to a compiler target) is coming to an end?
With tools like emscripten and js_of_ocaml, I can write C++, C, OCaml, Python, Java, Rust, Haskell, Objective-C, CIL (and any other language that compiles to LLVm bytecode[0]) and use that to power my browser scripting.
As we get closer to a Javascript as a bytecode, it seems like there may no longer be a need for Javascript the front-end. If I had to start a new app today, I think I might choose to do it in a unified language that either targets LLVM bytecode, or Javascript directly. In this way I could achieve unification of my server-side and browser-side code. Allow ease of maintenance, hiring, etc.
The only reason I can see actually "writing" Javascript continuing is in maintaining "legacy" code bases. Any thoughts?
[0] http://en.wikipedia.org/wiki/LLVM#Front_ends:_programming_language_support
- manidoraisamy 12y agoThe biggest advantage of javascript is quick prototyping + manipulating DOM objects with no tooling (you can debug with javascript console in the browser). I would die the day, I need a compiler to see a color change on a button.
- codygman 12y agoWhat if one of those compile to JavaScript languages forked Firefox and/or Chromium and added support to their languages in the tooling? Would that suffice for you?
- teknologist 12y agoDone: dart
- manidoraisamy 12y agoYes. As long as the compiler is invisible and fast enough to notice any difference. But then, will we ever have such compiler across all browsers?
- HelloNurse 12y agoDo you mean something like VBscript in old Internet Explorer versions? Do you understand why it died off?
- codygman 12y agoWas VBscript source code visible from the browser? What I'm recommending is basically something to replace Javascript in exactly the same way (except it's a sane* language). * I do concede ES6 is much much better
- HelloNurse 12y agoPeople would need to learn to not use Javascript, instead moving to a more exotic language (exotic in the context of DHTML scripting, not in general) with more complex and possibly less mature tooling. Given the current popularity of Javascript, this means that the exotic language must be very compelling; the two main reasons, reusing good libraries written in some other language and reusing good programmers who don't know and won't learn Javascript, appear rarely applicable (there are Javascript libraries for most needs and most developers involved in web development think they know enough Javascript) and they cover only a portion of most plausible projects or teams when applicable (there are important parts of the application beyond any library, and someone will want to use Javascript). As for actual language fetures (templates in C++, various functional styles in Ocaml and Haskell, etc.) a language fan needs to justify costs like performance loss, write-only generated Javascript code, flaky libraries, gigantic file sizes, and so on.
- bonn1 12y agoWith ES6 JS feels pretty mature, so the question is how much added value would another language provide and at which cost.
- cweagans 12y agoIn theory, sure, you could use any of those languages for real production work. But in practice, it just doesn't happen. Javascript is here to stay, I'm afraid.
- atrilumen 12y agoLately I've been very interested in targeting the browser with Haskell, using Haste [0]. It appears that, at least for now, this pretty much always requires some JavaScript FFI work to actually do things in the browser. This alone is enough to motivate me to keep honing my (functional) JS. ( It's also nice to be able to bang out something quick and dirty with minimal tooling. ) [0] http://haste-lang.org http://haste-lang.org
- codygman 12y agoI think GHCJS well mean having to use the JavaScript FFI much less.
- practicalpants 12y agoI doubt the MVC JavaScript fad will last much longer, but JS for just manipulating the DOM and basic web stuff won't go anywhere, especially because of the necessity of browser tools for webdev.
- api 12y agoI wish. I used Node recently for a project. Never again. It's just not a good language, for many reasons. The Node community is good, and the packages in npm are good, but the language itself is so wishy washy and has so many warts that if you try to do anything either very complex or performant it crumbles quickly. Of course that being said, I've gotten a bit jaded about dynamic languages in general. IMHO they deliver high productivity up front but you pay for it later X2 at least. But among dynamic languages Ruby, Clojure, and Python are orders of magnitude better than JavaScript. I feel like web developers have Stockholm syndrome with it. They've been forced to use it, so they sort of forced themselves to pretend it doesn't suck.
- S4M 12y agoCan you elaborate why you think Ruby and Python are "orders of magnitude better than JavaScript"? I always considered that Ruby, Python and JavaScript are very closed to each other - dynamic typing, very quick to write.
- api 12y agoIt's mostly to do with JavaScript's warts: - Can't deal with 64-bit integers - Insane type system, e.g. null vs. undefined and all kinds of complexity around seeing what something is. Types are strings? Really? - No baked-in language-standard way to do async coding despite the language being inherently async, which leads to a mishmash of promises and indent cascades with callbacks. - How do I use exceptions with callbacks or promises? All kinds of edge case hell here. Either have exceptions or don't. Again there are probably good patterns, but since there is no canonical way everyone does it differently. - The == vs === mess - Lots of fragmentation around how to do classes, inheritance, etc. Getting fixed in ES6, but there will forever be tons of legacy code where everyone did it differently. - In practice I've found it easier to get leaks in JS event-driven code than in other GC'd higher level languages. I'm sure others could list other things. JavaScript is the product of a death march at Netscape in the late 90s, and it shows.
- taurath 12y ago
- sandeshd 12y agoES6 gonna fix the little bit broken part of javascript.
- krapp 12y agoNot yet, because languages that compile to javascript don't actually replace javascript with anything but javascript. Plenty of people still write their own javascript, to do basic DOM manipulation and whatnot. I really can't imagine that the common use cases for JQuery, for instance, are better served by compiling C. It is a scripting language, even if you want to pretend it's "bytecode", and even if treating it as bytecode is useful for some people, I would argue that's still the exception and not the norm.
- indubitably 12y agoI hope not, Javascript is awesome.