4 ms·
Relevant: http://blog.izs.me/post/10213512387/javascript-is-not-web-assembly http://blog.izs.me/post/10213512387/javascript-is-not-web-as...
by sheetjs 13y ago
Relevant: http://blog.izs.me/post/10213512387/javascript-is-not-web-assembly http://blog.izs.me/post/10213512387/javascript-is-not-web-as...
- Pacabel 13y agoThe "JavaScript as the assembly language of the web" mentality seems to be taken most seriously by those JavaScript programmers who have absolutely no experience whatsoever with any sort of real assembly language. Many of them don't even have experience with something like C. It's one of those things that sounds good on the surface, but upon further inspection by those who know assembly language it's quite clear that it just isn't true. Yet this doesn't matter when in a crowd that consists of people who, as a whole, don't know assembly language. The claim can be parroted repeatedly, without anyone really questioning it properly. (I'm not directing this at resu_nimda, by the way. I see his comment more as a reference to the idea, rather than necessarily in support of it.)
- edtechdev 13y ago"taken most seriously by those JavaScript programmers who have absolutely no experience whatsoever" You mean like those at Google (dart), Microsoft (typescript), Mozilla (asm.js) and the developers of dozens of other languages that compile to javascript, I guess: https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS https://github.com/jashkenas/coffee-script/wiki/List-of-lang...
- Pacabel 13y agoImplementing one high-level language (CoffeeScript, TypeScript, etc.) via translation to another high-level language (JavaScript) does not make the target language an "assembly language" in any sense.
- ahuth 13y agoThe point of "JavaScript as the assembly language of the web" isn't that Javascript is exactly like Assembly was/is. The point is that Javascript is as low-level as web-programming gets, and you can craft Javascript manually or let a compiler create it for you (with CoffeeScript, etc.). Of course, the analogy isn't perfect, but that doesn't mean it doesn't fit.
- resu_nimda 13y agoBut it's so far from low level, that's the problem. Assembly language represents the raw fundaments of computing, as we have envisioned them. It maps directly to the actual capabilities of the hardware. If compiling to Assembly is like working with basic molecules, compiling to JavaScript is like working with lincoln logs. And you can build some impressive things with lincoln logs (just like you can build a computer in Minecraft), but you'll always be restricted to things that look like lincoln logs.
- transientbug 13y agoI think you're focusing on a different point then the argument. Javascript is often compared to the assembly language of the web because its a) low level web programming and b) its universal; both much like assembly in their own way. How low level do you need in web programming? Probably not that low, why? Because with web programming it has the potential of being much easier to do something malicious if you have access to the raw hardware like you do in assembly. The whole point of Javascript was to make more interactive sites, and when it comes down to it, Javascript does an awfully good job at being that low level language to do so; It has come to represent the raw fundamentals of web programming as we have envisioned them. So just because its a fully formed language that is much higher level than anything assembly comes close to, doesn't mean that it still isn't 'low level' with in its use case. Javascript also has the advantage of being universal, much like assembly. Assembly is universal in the sense that different flavors of instruction sets come on different microcontrollers but no matter what, nearly all uc's come with a reference guide which lists out the hex values for each instruction the CPU supports which can be used to build an assembler. These instruction sets all contain a core set of fundamentals such as basic math through the ALU, and storing/reading values and moving the PC and SC around. Which at the end of the day means that all uc's have support for an assembly language in some fashion that shares a common base. The same can be said with Javascript. Every browser comes with its own flavor of the language which supports the common base and then adds some fluff on top, but no matter what, nearly every browser comes with it. At the end of the day though, trying to compare these is nearly a null-point to me, because they were designed in completely different ages of computing, and are designed for different tasks and are not (not easily at least, although a uc with support for a Javascript vm is possible, and replacing Javascript with assembly is fully possibly, both are rather difficult tasks and as such this argument is, for practical reasons, null also) interchangeable.
- noname123 13y agoLet's build a HTML5-VM that run assembly instructions; and have a C compiler/assembler that compiles into it. I can put then HTML5-C and HTML5-asm into my LinkedIn and other social media profiles to really rub it into these youn'g faces.
- moron4hire 13y agoWould that be anything like LLVM and Emscripten?
- ma2rten 13y agoLike this https://developers.google.com/native-client/dev/ https://developers.google.com/native-client/dev/ ?
- TazeTSchnitzel 13y agoIt's called the "assembly language of the web" because it's the web's lowest common denominator that languages compile to, just like assembly language is the LCD of native platforms. More accurately, you'd say it's the "machine code of the web".
- gfodor 13y agoIt's an analogy, not an equivalence.
- Pacabel 13y agoOf course it's not an equivalence. But it's also not an analogy, either. There are really no similarities between the two. Just being capable of being a translation target for other high-level languages is totally insufficient to be considered similar to assembly language.
- gfodor 13y agoSorry, you completely missed the point of the analogy. The point of the analogy is that within the realm of the browser Javascript provides the most natural substrate for compiler code generation, much like assembly is the most natural target for code generation in many other environments. It's a pragmatic point not a theoretical one. It has almost nothing to do with the specifics of either Javascript or assembly language as mediums for writing programs. You're overanalyzing it to the point where I have to think you are trolling. (Disclaimer: I've worked on compilers that target both assembly language and compilers that target Javascript)