Menu
Baran Kahyaoglu Dev Blog
Baran Kahyaoglu Dev Blog

TypeScript

Posted on 08/10/201229/07/2015 by brnkhy

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?

Share on Social Media
twitter facebook linkedin reddit email

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Subscribe to Blog via Email

Follow me on Twitter!

My Tweets

Categories

  • Desktop Development (26)
  • Game Development (39)
  • Mapbox Unity SDK (4)
  • Uncategorized (8)
  • Unity3D (21)
  • Web Development (6)
  • WinRT Development (1)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2025 Baran Kahyaoglu Dev Blog | Powered by WordPress & Superb Themes