News for hackers. Stuff that matters.
Re:JavaScript is Not Web Assembly by mseepgood on Sunday March 31, 2013 @02:29PM (#5469605)
I always found it silly to compare an expensive language like JavaScript, that couldn't be further away from the machine, to assembly language. A language where data stuctures are hash maps with string keys, where numbers are boxed doubles on the heap, etc.

An array of points in C: http://s3.mrale.ph/images/array-of-points-structure-c.png

An array of points in JavaScript: http://s3.mrale.ph/images/array-of-points-structure-javascri...

Re:JavaScript is Not Web Assembly by skwirl on Sunday March 31, 2013 @06:16PM (#5470390)
I think the point is something like this: Assembly is the only language your machine can run. Everything else your machine does must eventually be converted to a machine instruction. Javascript is the only client side DOM manipulation scripting language that all browsers can run. Everything else (CoffeeScript, for example) must eventually be converted to javascript.

I think that is the core of the analogy, and it is not talking about how high or low level each language is in an absolute sense but in a relative sense. It is talking about it being the "at the metal" language of machine instructions and browser "instructions" respectively.

Of course, there are other parallels, but they aren't as strong. Part of the reason for using CoffeeScript is because of a perceived increase in expressiveness, but that increase is very small compared to the improvement of C over assembly (as the author of this article points out).

Re:JavaScript is Not Web Assembly by gngeal on Sunday March 31, 2013 @04:26PM (#5470071)
"where numbers are boxed doubles on the heap, etc."

Actually, you don't know that. Since doubles are immutable, the runtime can (and does) cheat, including turning many of them into integers. It all boils down to predictable usage patterns.

Re:JavaScript is Not Web Assembly by Lerc on Sunday March 31, 2013 @02:37PM (#5469637)
That is not the only way to do it in Javascript though. if you allocate an ArrayBuffer then you are dealing with a plain block of bytes that you can treat as points (or anything else).

These are the things that Javascript has been growing to facilitate the idea of js as asm. Emscripten uses ArrayBuffers to allow C to compile to JS without the messiness.

Re:JavaScript is Not Web Assembly by MostAwesomeDude on Sunday March 31, 2013 @04:13PM (#5470028)
You really feel that JS "couldn't be further away from the machine?" What about languages that don't have a specified execution model? Haskell and other MLs, for example.
Re:JavaScript is Not Web Assembly by gngeal on Monday April 01, 2013 @08:48AM (#5472691)
I believe that these languages do have a specified execution model (how would you execute them without one?), they just don't have any hard prescription as to how to map it onto hardware the same way that, for example, C does.
Re:JavaScript is Not Web Assembly by camus on Sunday March 31, 2013 @02:36PM (#5469634)
nobody serious said javascript was the assembly of the web,that's the issue.
Re:JavaScript is Not Web Assembly by xd on Sunday March 31, 2013 @03:46PM (#5469935)
But there lies the issue, it IS serious when you cross meanings in any professional field.