Soooo guess it’s time to learn some Javascript eh? Now that even Anders Hejlsberg doing it.
Just in case you don’t know, TypeScript, created by Ander Hejlsberg, is a typed superset of Javascript with a much more C#-like flow and ECMA standards. Pretty much like CoffeeScript one might say. Or somewhat comparable to Dart I guess. Yea it’s like the 1000th attempt to fix Javascript and probably no one would have taken it seriously if it wasn’t for Microsoft and Hejlsberg.
Feels kinda weird really. Hejlsberg? Doing Javascript? I mean after Turbo Pascal, Delphi and C#, Javascript feels kinda odd.
But if all mighty & all knowing Anders think this might work, I sure won’t dare to question his wisdom.
One interesting thing though, from Miguel de Icaza’s blogpost on TypeScript;
Dart on the other hand is more ambitious as it uses the type information to optimize the quality of the generated code. This means that a function that adds two numbers (function add (a,b) { return a+b;}) can generate native code to add two numbers, basically, it can generate the following C code:
double add (double a, double b)
{
return a+b;
}
While weakly typed Javascript must generated something like:
JSObject add (JSObject a, JSObject b)
{
if (type (a) == typeof (double) &&
type (b) == typeof (double))
return a.ToDouble () + b.ToDouble ();
else
JIT_Compile_add_with_new_types ();
}
This is kinda interesting. I never knew that but sounds like a great idea. For some reason, TypeScript doesn’t go into that kinda of optimization. Makes me wonder though, why? My first guess is that TypeScript ( unlike Dart ) is a superset of JavaScript and such optimizations might break that. Or maybe they thought it just doesn’t worth it? ( scratch that. surely it’s because of the standard javascript engine compatibility. Silly me. )
Oh well, guess I’ll post some JS stuff soon. It can’t be THAT bad, right?