Slashdot Mirror


TypeScript: Microsoft's Replacement For JavaScript

mikejuk writes "Everyone seems to have a replacement for JavaScript — Google even has two. Now Microsoft has revealed that Anders Hejlsberg, the father of C# among other languages, has been working on a replacement and it has released a preview of TypeScript. The good news is that it is compatible with JavaScript — you can simply load JavaScript code and run it. JavaScript programs are TypeScript programs. To improve on JavaScript, TypeScript lets you include annotations that allow the compiler to understand what objects and functions support. The annotations are removed by the compiler, making it a zero overhead facility. It also adds a full class construct to make it more like traditional object oriented languages. Not every JavaScript programmer will be pleased about the shift in emphasis, but the way it compiles to a JavaScript constructor is fairly transparent. At this early stage it is difficult to see the development as good. It isn't particularly good for JavaScript developers who already have alternatives, and it isn't good for C# developers who now have confirmation that Ander Hejlsberg is looking elsewhere for his future." Update: 10/01 20:34 GMT by U L : It's also freely available under under the Apache 2.0 license, and there's a language specification available. It looks pretty interesting: it even has ML-style type inference (including e.g. deducing the types of higher order functions).

9 of 488 comments (clear)

  1. I am still busy with silverlight by superflit · · Score: 5, Funny

    Sorry..
    I am still busy with silverlight...

    Oooppss. that did not work....

  2. CoffeeScript, Dart and this - screw it all by thetoadwarrior · · Score: 5, Insightful

    We have JavaScript and that's shit because no one wants to agree on anything. So what do we get instead? a dozen implementations or something that is in theory nicer but compiles to JavaScript. This is not a solution. It's a mess.

    Fix JavaScript or give us something like Python minus the dangerous bits in the browser.

    1. Re:CoffeeScript, Dart and this - screw it all by neminem · · Score: 5, Funny

      Yeah, well, you sound like a... person who... isn't very good at comebacks.

      Also, your mom.

  3. 0 day exploit found in TypeScript by logicassasin · · Score: 5, Funny

    I'm going to leave this here as a placeholder for the inevitable...

    --
    Fifty watts per channel, baby cakes.
  4. Re:Remember the old addage by MHolmesIV · · Score: 5, Insightful

    Rubbish. Not a good view of the technology. You might want to watch the channel 9 video and see how the language works before sounding the war horns. Essentially it's an overlay on javascript code that allows the developer to infer useful information about their code. The output from the "compiler" is bog standard javascript, no microsoft extensions at all.

    So if the "carpet" ever got pulled out from under you, all you would do is go back to editing the standard .js directly.

  5. Do you have a karma allergy? by Qubit · · Score: 5, Funny

    Obligatory: http://xkcd.com/927/

    Note: please do not mod this post up.

    Note: please do mod this post up

    --

    coding is life /* the rest is */
  6. Re:Remember the old addage by Anonymous Coward · · Score: 5, Insightful

    Embrace, Extend, Extinguish.

    Microsoft freely admits it, and when everyone jumps on the TypeScript bandwagon, the carpet will be pulled out from under you.

    How is this shit modded 'Insightful'? Karma whoring at its best, capitalizing on the nerd rage of geeks frothing at the mouth whenever Microsoft does anything. The fact is it is under an Apache 2.0 license, the spec is available and there are already 5 forks, so unless you have a fundamental misunderstanding of what EEE means you're just trolling.

  7. Re:Remember the old addage by Anonymous Coward · · Score: 5, Insightful

    Is it just me or are the MS shills getting even more stupid?

    When Apache 2.0-licensed, publicly available (on Git), already forked code is somehow getting you "locked in" and "manipulated to be incompatible" i think it's safe to say the stupidity lies with all the anti MS morons with their senseless EEE rhetoric. Although given you think pointing out that this is about as open as it can get which makes it the exact opposite of "locking people in" is being a "shill" you're probably not much different.

  8. I call for web byte-code by devent · · Score: 5, Interesting

    So can we finally have a specification that is not bound to a specific implementation? Why in all what is good and holy, do we need the limitation of JavaScript? Just make a byte-language specification, just like the CLR or Java Byte-Code for the DOM stuff.

    Then everyone are free to use Python, Ruby, Java or what else as a language, the browser needs only to interpret the Byte-Code that the language-compiler is producing (just like with Java and javac, where you can use any language you like to produce the Java byte-code).

    If you are really worried about open source, then answer me this: What is the difference between this and byte-code? There is none, because both are not human-readable. So why not just to agree to a byte-code that interfaces the DOM and html5 and then we can use any language we like to generate the byte-code?

    Wouldn't it be nice to fire up your favorite IDE or editor and just write Python or Ruby (or insert here your favorite language) for your web-page? But no, we just have to use JavaScript until the end of the universe.

    PS: most browsers are compiling JavaScript to a byte-language anyway nowadays, because then they can optimize the byte-code so JS will run faster.

    --
    http://www.mueller-public.de - My site http://www.anr-institute.com/ - Advanced Natural Research Institute