10 ms·
JavaScript is Web Assembly Language and that's OK.
- TheCondor 13y agoI prefer to think of it as web COBOL.
- mbrock 13y agoIsn't it more like, uh, Java for the web, except without a bytecode? This analogy is just weird.
- Drakim 13y agoJava was always an external plugin to the web (like Flash), while JavaScript sits more comfortable in the same shelf alongside HTML and CSS.
- mbrock 13y agoThe web is an external plugin to the computer. JavaScript is its programming language.
- codeulike 13y agoThe article does say "Maybe 'JavaScript is the Web's Bytecode' is better." - in the first parapgraph.
- xradionut 13y agoJavaScript is a kludge. It's a bag on the side of a bag. The amazing thing is that it works well enough to be useful.
- codeulike 13y agoJavaScript is a dynamic language with C-syntax, prototype-inheritance and lambdas. Embedded into every browser on the planet. Whats not to like?
- vijayp 13y agoAlso, no integers. Who needs integers anyway?
- codeulike 13y agoOk, thats true. And some of the built-in functions are crazy - parseInt("09") anyone? - but the basic workings of the language seem ok to me.
- zxcdw 13y agoThe problem is that when the base language has such limitatios and funky semantics, how should languages which target that be able to deal with that in 1) standard 2) predictable 3) efficient way? This is the reason CPU instruction set architectures are so simplistic and "low level" and don't really do things for you -- because if they did, targetting such a CPU would be a major pain with all inefficiencies due to workarounds due to funky and incompatible features.
- ihsw 13y agoType-casting is a nightmare in all languages that utilize duck-typing, both implicit and explicit type-casting causes trouble in unexpected ways.
- thejsjunky 13y agoThat's a fair criticism, but it needs qualification. JS doesn't have an integer type currently, but engines can be smart about using integers behind the scenes for efficiency. In terms of your ability to use them explicitly there's asm.js, typed arrays, and various proposals like value objects for the future.
- azakai 13y agoDynamic languages typically lack them: Lua, Python, Ruby, JavaScript, etc.
- arocks 13y agoOne of the endearing qualities of web design and development was how the source was open for everyone (HTML, CSS and JS). Developers could read the code, understand and remix each other's work. This helped in its rapid growth from a design platform to an application platform. Enter asm.js, where the source code is as readable as a compiler's assembly output. Once again we are back to code that is hard to hack and improve. Sort of similar to the days of Flash except that entire applications are being built on this platform. It might be a great end user experience, but it is not the best way forward for web development.
- k__ 13y agoI know, there was a time when people took their scripts from different sites and included then into their own. But does this still happen? I mean most of the scripts are minified anyways :\
- jiggy2011 13y agoPeople still do that, when they want a rotating banner effect for their website or whatever. Once you get into more complex applications it doesn't really make sense to do that anymore.
- k__ 13y agoI see... maybe if you get fluent enough with JS, you're just faster hacking such little scripts than finding a page, copy it and reassemble it.
- jiggy2011 13y agoWell jquery-ui solves this problem to a large extent, if you want something like say a datepicker you can do $("#datepickerelement" ).datepicker(); and get the functionality you need in a nice reusable package without having to copy and paste giant chunks of code and pollute your global namespace.
- wwwtyro 13y ago
- wslh 13y agoI bet that in less than 10 years we are running a standard VM in the browser instead of Javascript. BTW, it would be interesting to add real $$$ bets in HN. In this way users can play with real money, not only with argumentation.
- mattmanser 13y agoBoth the Chrome and Firefox teams seem so incredibly reluctant to do it though and are almost desperately trying to do anything but.
- pekk 13y agoI don't see how Chrome is dragging its feet on this.
- deleted 13y ago[deleted]
- michaelwww 13y agohttp://longbets.org/ http://longbets.org/
- wslh 13y agoYes, I would like to have one integrated in HN :-)
- michaelwww 13y agoI wouldn't bet against you on this!
- wslh 13y agohttp://predictionbook.com/ http://predictionbook.com/ ?
- JonSkeptic 13y agoIt would be OK if Javascript was a better language. It is terrible, but it works. Most importantly, there is no alternative. That's why we use it.
- jiggy2011 13y agoassembly is a pretty nasty language if one tries to write an entire program in it.
- JonSkeptic 13y agoAgreed, but there are numerous alternatives that compile easily to assembly without ridiculous amounts of set up and prayer. We can program in C, C++, Python, Ruby, Java, any number other languages that will ultimately all be executed in the exact same fashion, barring some technical differences. This does not exist for Javascript. You can jump through hoops to compile other code to Javascript and hope that it works and works acceptably, that's it. Javascript isn't assembly, it's the only language and it's terrible.
- jiggy2011 13y agoIsn't this what asm.js attempts to provide? With mature tooling it should be possible to code in whichever language and compile or run on top of a VM which itself runs atop asm.js without having to worry about the underlying JS much at all (unless you want serious optimisation). It wouldn't surprise me if we eventually come full circle and discard the DOM entirely. Each web application is just a giant <canvas> with QT or something compiled to JS providing the UI elements.
- _pmf_ 13y ago> It wouldn't surprise me if we eventually come full circle and discard the DOM entirely. Each web application is just a giant <canvas> with QT or something compiled to JS providing the UI elements. The shocking thing is that we are almost at a point where a solution that sounds as stupid as that is actually less contrived and complex than the current mess.
- Herald_MJ 13y agoNo, it's not, and it's certainly not OK. Javascript is a quirky interpreted scripting language created for scripting minor workflow events. It's an afterthought by Netscape, duct-taped to a bundle of silly hacks, wrapped up in some interesting attempts to standardise, with a few more vendor-specific hacks crowbarred in there for good measure. asm.js is one more hack on top of the mess, and while it's technically interesting, and probably very useful (much like the rest of javascript), we shouldn't be building these monstrous feats of engineering on top of such shaky foundations. > there's only one language that works everywhere without installation or trouble and that's JavaScript. This is true. But we've arrived at this situation virtually by chance, and it's a huge mess and we shouldn't be readily accepting it. We need a real bytecode for the web, we need it to be standardised and we need to push for browsers to support it. NaCl seems to be the furthest down the road to this objective so far.
- _pmf_ 13y agoConcise and correct; there's really not much more to say on this topic.
- deleted 13y ago[deleted]
- tg3 13y agoJavascript is not just a "quirky scripting language for minor workflow events." It is a powerful, expressive language, that has many benefits over contemporary languages, regardless of setting. Yes, it has quirks, and yes, there are some things that coming from another language are difficult to grasp, but it is not a Bad Language. The fact that Node.js, Javascript on the server, is gaining so much popularity in the developer community means that it has benefits beyond its universality in the browser. Asm.js is not a "hack on the top of the mess", it's a simplification of "the mess" down to it's simplest, most bytecode-esque parts. And it's performance is shockingly close to Native. Javascript is not the perfect bytecode for the web. But it does work as a bytecode for the web, and with asm.js, it seems that it works decently well. I think efforts are better spent improving Javascript, asm.js, and languages that can target it rather than swimming upstream.
- zxcdw 13y agoI don't understand why people say such silly feats of pseudo-"engineering" are somehow "OK" and acceptable. How have we arrived to this situation? I get that 1) agreeing upon a more sane bytecode-based language for the web 2) implementing it on all major browsers 3) changing the tooling and workflow(no more a .js file, save and open in browser but a compiled file instead) would perhaps be not worth the benefit(more sane target, better support for common programming constructs without performance, safety or determinism issues and so on). Simply, people don't give a fuck, web works "well enough" and iterative engineering solves the major problems. These just are things we have to deal with, something we can't change, which I find pitiful but understandable, but most definitely not "OK" or acceptable.
- pornel 13y ago> I don't understand why people say such silly feats of pseudo-"engineering" are somehow "OK" and acceptable. Network effect and worse is better. Any solution that cannot be introduced gradually with backwards- and forwards-compatibility is very unlikely to gain traction on the web. You'll always get a vendor that doesn't like some tech or has multi-year-long development/distribution/upgrade process. Tools can be even slower to upgrade and you'll also need to educate developers and get them out of their comfort zones. It's not that people don't give a fuck. It's not pseudo-"engineering". It's the best you can get within constrains that are both technical and social.
- tomaszkubacki 13y agoReposting my comment here: Reality is Chrome has the majority on the browsers market and since it will contain Dart Virtual Machine my bet is Dartlang is the future technology of the web (seen recent Dart benchmarks? In some cases Dart beats even Java). Dart is done by the same people who have done fastest JS VM on the market (Google's V8) Even more important killer Dart features JS asm.js and other compiled to JS langs will never have is: a) snapshoting (allows app to start almost instantly) b) consistent API (http://api.dartlang.org/docs/releases/latest/ http://api.dartlang.org/docs/releases/latest/) c) tooling (Dart IDE) for all platforms (Win, OSx Linux) with good ecosystem (Jetbrains, Adobe) Dart will be what .NET could be if it was open source from the beginning. Hope some day we will see Dart VM on other browsers (it is open source)
- fetbaffe 13y agoThanks to JavaScript we rediscovered functional programming, because we realized that the inheritance model Java polluted everywhere just stinks.
- Ygg2 13y agoI had a silly idea. Why not make LLVM a part of browsers? I heard it was a really performant albeit hard to write languages in. It seems to not have the stigma attached to JVM, especially association with oracle.
- mwcampbell 13y agoThis is what PNaCl (Portable Native Client) is trying to do. I'm skeptical though; PNaCl is still experimental in Chromium 29 (the current development version), and requires the browser to download extra files outside of the Chromium package itself, probably because LLVM is quite bulky. If we're going to run high-performance code with the C memory model in a browser, I think asm.js is the best way to do it.
- mwcampbell 13y agoWhat bothers me about asm.js and Emscripten is that, if used on a large scale, they'll perpetuate the C memory model, that is, a single flat heap of arbitrary size in which things are referenced via fixed pointers. Perhaps this memory model is necessary for small pieces of high-performance code, but I wouldn't want us to keep using it as the primary memory model for new applications, especially when at least some of the current JS engines have advanced copying/compacting garbage collectors. I would love to have a memory-safe language that compiles to efficient JavaScript with no intractable semantic or runtime mismatches between the JS and the source language or its libraries (e.g. no preemptive threads with shared memory) and takes full advantage of the JS engine's garbage collection, but can also be compiled ahead-of-time to fairly efficient native code for environments where JIT compilation isn't an option (e.g. iOS apps). I suspect that a language like this would need static typing. To gain traction, such a language would need to stick to fairly mainstream concepts (e.g. not purely functional). Perhaps this language could be a subset of JS itself. The trouble with Java and C# is that their standard libraries and most third-party libraries assume multiple threads and blocking APIs; perhaps the compiler to JS could transform the code into continuation passing style.
- taylodl 13y agoJavaScript is most emphatically not the assembly language of the web. It is instead the lingua franca of the web. I actually think this is what people intend to convey when they say this sort of nonsense.