<story><title>JavaScript is Not Web Assembly</title><url>http://blog.izs.me/post/10213512387/javascript-is-not-web-assembly</url></story><parent_chain><item><author>jashkenas</author><text>I usually try not to weigh in on these debates -- I imagine &lt;a href=&quot;https://groups.google.com/forum/#!topic/nodejs/a7yVzBw1sJk&quot; rel=&quot;nofollow&quot;&gt;https://groups.google.com/forum/#!topic/nodejs/a7yVzBw1sJk&lt;/a&gt; is what triggered this post. But...&lt;p&gt;Mr. Schlueter is right on -- C++ is a much more accurate comparison, and especially so because it was originally implemented as a cross-compiler into C source code (circa 1983-1990).&lt;p&gt;That said, saying that the desire to compile into JavaScript is (to paraphrase the post) pathological language-wank craziness, is a bit extreme.&lt;p&gt;I&apos;d like to think that the reason why CoffeeScript has caught on like wildfire, when there are so many other AltJS languages out there (&lt;a href=&quot;https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS&quot; rel=&quot;nofollow&quot;&gt;https://github.com/jashkenas/coffee-script/wiki/List-of-lang...&lt;/a&gt;) is that we&apos;re trying to take the deeply pragmatic approach.&lt;p&gt;Mr. Schlueter writes &quot;you don’t compile it to target a given platform,&quot; as if this would be an advantage or a justification for existing ... when it&apos;s really quite the opposite. JavaScript is plagued with libraries that will only ever run on certain platforms because they opt-in to platform specific features. I can&apos;t use your simple pluralization library to turn &quot;bit&quot; into &quot;bits&quot;, because it was only written to run on Node.js, and is riddled with `forEach` and `require`, or because it was only written for the browser, and hides data in the DOM.&lt;p&gt;CoffeeScript tries very hard to compile into efficient, lowest-common-denominator JavaScript (read avoid Internet Explorer bugs) because that&apos;s how your library can be used widely across devices and runtimes, while being reasonably future proof.&lt;p&gt;I don&apos;t know when &quot;order of magnitude difference&quot; became a synonym for &quot;worthwhile difference&quot;, but ... how much easier does a program have to be to read and write before it becomes a worthwhile choice to make the change? 2x? 1.3x?&lt;p&gt;In any case, CoffeeScript is a little thought experiment -- not a corporate project, or a Dart-like browser takeover. If it suits your fancy, use it, and if it itches you the wrong way, by all means leave it out.</text></item></parent_chain><comment><author>Rusky</author><text>The desire to compile into JavaScript is not what&apos;s being criticized here; it&apos;s the &quot;blah is to JS as C is to Assembly&quot; analogy: &quot;That’s not to say that any of these systems are bad, just that the “blah is to JS as C is to Assembly” analogy is wildly wrongheaded.&quot;&lt;p&gt;Trying to treat JavaScript as assembly is silly because it doesn&apos;t vary too much between browsers- it is palatable to write, by hand, cross-browser JS programs, whereas it is literally impossible to do so in assembly because different assembly languages, as human-readable machine code, have virtually nothing in common at that level.&lt;p&gt;Treating JavaScript as C is the reality, because JavaScript is what gets run in different browsers (the analogy to compiling C to different platforms).&lt;p&gt;CoffeeScript is more like C++ than C because the language it&apos;s replacing/augmenting/etc. is very similar semantics-wise- it&apos;s just trying to make the same basic idea nicer to work with. The 10x difference thing is pointing out that C-&amp;#62;assembly is a massive translation, whereas C++-&amp;#62;C, while still a worthwhile difference, is much smaller.&lt;p&gt;Again, this is not a value judgement of CoffeeScript or GWT or anything. It&apos;s pointing out a flawed analogy. This is useful because when we think of JS as C rather than Assembly, it becomes clear that it shouldn&apos;t be the only option. It would be an improvement if, in the future, more mature language compilers could bypass JS to some form of bytecode (be it browser-specific, which would be a much bigger problem in the browser world, or a standardized one like the JVM does for the non-browser world... this is where the analogy breaks down a little).</text></comment>
<story><title>JavaScript is Not Web Assembly</title><url>http://blog.izs.me/post/10213512387/javascript-is-not-web-assembly</url></story><parent_chain><item><author>jashkenas</author><text>I usually try not to weigh in on these debates -- I imagine &lt;a href=&quot;https://groups.google.com/forum/#!topic/nodejs/a7yVzBw1sJk&quot; rel=&quot;nofollow&quot;&gt;https://groups.google.com/forum/#!topic/nodejs/a7yVzBw1sJk&lt;/a&gt; is what triggered this post. But...&lt;p&gt;Mr. Schlueter is right on -- C++ is a much more accurate comparison, and especially so because it was originally implemented as a cross-compiler into C source code (circa 1983-1990).&lt;p&gt;That said, saying that the desire to compile into JavaScript is (to paraphrase the post) pathological language-wank craziness, is a bit extreme.&lt;p&gt;I&apos;d like to think that the reason why CoffeeScript has caught on like wildfire, when there are so many other AltJS languages out there (&lt;a href=&quot;https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS&quot; rel=&quot;nofollow&quot;&gt;https://github.com/jashkenas/coffee-script/wiki/List-of-lang...&lt;/a&gt;) is that we&apos;re trying to take the deeply pragmatic approach.&lt;p&gt;Mr. Schlueter writes &quot;you don’t compile it to target a given platform,&quot; as if this would be an advantage or a justification for existing ... when it&apos;s really quite the opposite. JavaScript is plagued with libraries that will only ever run on certain platforms because they opt-in to platform specific features. I can&apos;t use your simple pluralization library to turn &quot;bit&quot; into &quot;bits&quot;, because it was only written to run on Node.js, and is riddled with `forEach` and `require`, or because it was only written for the browser, and hides data in the DOM.&lt;p&gt;CoffeeScript tries very hard to compile into efficient, lowest-common-denominator JavaScript (read avoid Internet Explorer bugs) because that&apos;s how your library can be used widely across devices and runtimes, while being reasonably future proof.&lt;p&gt;I don&apos;t know when &quot;order of magnitude difference&quot; became a synonym for &quot;worthwhile difference&quot;, but ... how much easier does a program have to be to read and write before it becomes a worthwhile choice to make the change? 2x? 1.3x?&lt;p&gt;In any case, CoffeeScript is a little thought experiment -- not a corporate project, or a Dart-like browser takeover. If it suits your fancy, use it, and if it itches you the wrong way, by all means leave it out.</text></item></parent_chain><comment><author>mvzink</author><text>I&apos;m bothered by these bits:&lt;p&gt;&lt;i&gt;Mr. Schlueter writes &quot;you don’t compile it to target a given platform,&quot; as if this would be an advantage or a justification for existing ... when it&apos;s really quite the opposite.&lt;/i&gt;&lt;p&gt;&lt;i&gt;I don&apos;t know when &quot;order of magnitude difference&quot; became a synonym for &quot;worthwhile difference&quot;&lt;/i&gt;&lt;p&gt;I didn&apos;t see Schlueter arguing either of these things, but we may have read the post differently. Both points, in my view, seemed only to illustrate that the JS-Assembly analogy is wrong, not to argue against to-JS languages.</text></comment>