But does this still happen?
I mean most of the scripts are minified anyways :\
Once you get into more complex applications it doesn't really make sense to do that anymore.
$("#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.
In those rare cases I've done this in the last few years, the sum total has always been to find out which CSS property or JS function I didn't know about was being used, and then simply pop that into Google. I certainly didn't stare at their code for any longer than that.
What do you mean? Isn't it roughly as readable as C?
Due to very limited set of expressions available it's too hard to write by hand (e.g. no objects, casts required everywhere, one flat array representing memory), so all non-trivial asm.js programs are spit out by compilers that treat it like assembly and preserve very little structure of source programs.
Q. Is asm.js a new language?
A. No, it's just (a subset of) JavaScript. An asm.js program will behave identically whether it is run in an existing JavaScript engine or an ahead-of-time (AOT) compiling engine that recognizes and optimizes asm.js—except for speed, of course!
Also, the examples in the spec are completely legible. It looks much like C, in fact.
If you do not minify the output, then asm.js's readability is somewhere in between x86 and C. It's far easier to understand than x86, but it is still definitely less readable than handwritten C because it's machine-generated and optimized.
From the link you gave, the DiagModule function is asm.js, and every bit as readable as C.
I think people may think I'm trying to be faintly critical, but I'm not. It's just the nature of the beast.
That Gist - what is visible from "View Source" after beautification - is not compiled asm.js code. It is not the result of any compilation. It is the result of minification. Most minified code is as illegible as that.
Hand-written asm.js code is not going to be the norm, for the forseeable future, for a variety of reasons. The rules for the grammar are difficult and tedious to manually write. The fact that everything runs in a massive array, so you've got a lot of memory management to write, is going to be a problem. The existence of numbers like 1384465 and 4980736 is what makes that particularly hard to read. Most asm.js code on the web is going to be incomprehensible; the examples you can read are the exceptions, for didactic purposes, not the rule.
Wow. No, it absolutely is not. I have no idea what you could possibly mean by "not entirely" compiled.
>The rules for the grammar are difficult and tedious to manually write.
There's nothing difficult about the syntax. It's a subset of javascript.
> The fact that everything runs in a massive array, so you've got a lot of memory management to write, is going to be a problem.
No more difficult than managing memory in C.
> The existence of numbers like 1384465 and 4980736 is what makes that particularly hard to read.
The lack of meaning for those numbers is what makes it hard to read. It wouldn't matter if 1384465 were 2 or "a". It's been minified, so the meaning has been stripped away. I agree that it is hard to read, but it's not a result of using asm.js, it's a result of minification and auto-generating code. There's nothing inherently illegible about asm.js.
> Most asm.js code on the web is going to be incomprehensible; the examples you can read are the exceptions, for didactic purposes, not the rule.
Sure, just like most javascript on the web is incomprehensible, by virtue of being minified or auto-generated.
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.