Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

JavaScript assembly

Name: Anonymous 2013-02-15 17:07

http://asmjs.org/spec/latest/

Defines asm.js, a strict subset of JavaScript that can be used as a low-level, efficient target language for compilers.

Not only is JavaScript making other high-level languages obsolete, but it's making low-level languages obsolete as well! Contact your hardware manufacturers: tell them you want JavaScript all the way down.

Name: Anonymous 2013-02-16 1:39

JavaScript is inconsistent and broken:
1. The Achilles Heel of JavaScript is its inconsistent behavior across implementations. It is virtually impossible to use it to do anything robust on the client side.
2. JavaScript type system is broken: it is weak and its automatic coercion astonishes: "1"+"2"=="12" and "1"+1=='12', but "1"-2==-1, "2"*"3"==6, and (x="1",++x)==2. [123]==123, but [123][0]!=123[0]. Even worse: (a=[0], a==a && a==!a)==true;  Following statements are also true: Math.min()>Math.max(), " \t\r\n"==0, ",,,"==Array((null,'cool',false,NaN,4)), new Array([],null,undefined,null)==",,,", ''!='0', 0=='', 0=='0', false!='false', false=='0', false!=undefined, false!=null, null==undefined, NaN!=NaN, []+[]=="", []+{}=="[object Object]", {}+[]==0, {}+{}==NaN, despite (typeof NaN)=="number", so ("S"-1=="S"-1)==false. Given function f(number) {return number && + number | 0 || 0;}, we have f("1")==1, f("1.2")==1, f("-1.2")==-1, f(1.2)==1, f(0)==0, f("0")==0, f(NaN)==0, f(1/0)==0. Whereas most languages have one universal singular value (null/nil/Void/whatever), JavaScript has three: "false", "null" and "undefined". That leads to confusing and irregular semantics. No numerical tower or even obvious integer types: the only numeric type supported is an IEEE754 double-precision float. Hacks like `(x+y)|0` are employed to coerce doubles to integers.
3. Broken lexical scoping: unlike C/C++/Java/C#/etc, where variables introduced in an anonymous block within a function are only valid within that block; in JavaScript such variables are valid for the entire function. JavaScript employs unintuitive process called declaration hoisting, in which all function and variable declarations are moved to the top of their containing scope. If a variable is declared and assigned in one statement then the statement is split into two, with only the declaration getting hoisted. This produces a lot of subtle bugs, like for example non-obvious hiding of outer variables or `f` in `var f = function() {…}` being present as undefined, while `function f() {…}` would always be defined. Every script is executed in a single global namespace that is accessible in browsers with the window object.
4. Annoying gotcha in array constructor: new Array() produces empty array; new Array(2,3) produces array with 2 and 5 as its elements; new Array(5) does not produce array with 5 as its single element; instead, it returns a 5-element array. In JavaScript an array with 2 elements can have length of 7, while an array with 7 elements can have length 2, because length property always returns the last numeric index, plus one. JavaScript has no out of bounds error: you can freely retrieve an element at any index and no error will be produced, even if element is undefined. JavaScript provides no reliable way to iterate array by index, instead for(var X in Xs) gives elements in completely undefined order.
7. Crippled syntax impeding functional programming: )}();)}();)}();)}();

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List