Today Microsoft announced TypeScript a typed superset of Javascript. This means that existing Javascript code can be gradually modified to add typing information to improve the development experience: both by providing better errors at compile time and by providing code-completion during development.
As a language fan, I like the effort, just like I pretty much like most new language efforts aimed at improving developer productivity: from C#, to Rust, to Go, to Dart and to CoffeeScript.
A video introduction from Anders was posted on Microsoft's web site.
Type information is erased when it is compiled. Just like Java erases generic information when it compiles, which means that the underling Javascript engine is unable to optimize the resulting code based on the strong type information.
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 (); }
The majority of the Web is powered by Unix.
Developers use MacOS and Linux workstations to write the bulk of the code, and deploy to Linux servers.
But TypeScript only delivers half of the value in using a strongly typed language to Unix developers: strong typing. Intellisense, code completion and refactoring are tools that are only available to Visual Studio Professional users on Windows.
There is no Eclipse, MonoDevelop or Emacs support for any of the language features.
So Microsoft will need to convince Unix developers to use this language merely based on the benefits of strong typing, a much harder task than luring them with both language features and tooling.
There is some basic support for editing TypeScript from Emacs, which is useful to try the language, but without Intellisense, it is obnoxious to use.
Posted on 01 Oct 2012