Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
Programming News

TypeScript: Microsoft's Replacement For JavaScript 488

Posted by samzenpus
from the no-code-on-the-block dept.
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).
This discussion has been archived. No new comments can be posted.

TypeScript: Microsoft's Replacement For JavaScript

Comments Filter:
  • by turgid (580780) on Monday October 01, 2012 @04:36PM (#41518539) Journal

    JavaScript programs are TypeScript programs.

    'Nuff said.

    and it isn't good for C# developers who now have confirmation that Ander Hejlsberg is looking elsewhere for his future.

    It's C++ all the way down!

  • by thetoadwarrior (1268702) on Monday October 01, 2012 @04:42PM (#41518613) Homepage
    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.
  • by Anonymous Coward on Monday October 01, 2012 @04:50PM (#41518697)

    Bullshit. Look at other languages that compile to JavaScript that also don't pollute the standard:
    https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

    The summary is just wrong. JavaScript isn't being replaced. It's being enhanced in an entirely compatible and most importanly voluntary way.

  • by Anonymous Coward on Monday October 01, 2012 @04:51PM (#41518703)

    It makes me cry whenever I hear JavaScript being used as an 'assembler'.

    CPU performance, memory usage, and power consumption be damned!

  • by MHolmesIV (253236) on Monday October 01, 2012 @05:03PM (#41518871)

    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.

  • by MHolmesIV (253236) on Monday October 01, 2012 @05:05PM (#41518907)

    Um, the Apache License is significantly more free than the GPL. Just sayin'.

  • by Anonymous Coward on Monday October 01, 2012 @05:11PM (#41518963)

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

    Full Python is a relatively heavy language (compared to, say, Lua), and I would be less than thrilled if all browsers had to implement a Python interpreter in addition to the Javascript interpreter they would still require for compatibility.
    Besides, Python is all dangerous bits.

    I think a lightweight virtual machine would be a natural successor. If they had done it in the 90s it would be a considerably worse legacy than Javascript was, but I think we're ready for it now.

    Some desirable properties would be:

    • - Implementable as a small and simple interpreter
    • - Implementable as an efficient JIT compiler
    • - The VM and the ECMAScript implementation should be able to share a JIT, e.g. by compiling scripts to VM, or a common immediate representation.
    • - Must share the DOM and APIs with ECMAScript
    • - A reasonably efficient ECMAScript implementation of the VM
    • - Programs specifiable as either text or binaries

    (LLVM bytecode is NOT suitable for this; it is first and foremost a compiler IR, and is not intended for cross-platform use.)

  • by Nyder (754090) on Monday October 01, 2012 @05:11PM (#41518969) Journal

    Sticking with C.

    How many computer languages do we need? Really?

    It's bad enough that you don't trust javascript from webpages, now i have a new type not to trust?

    Microsoft, i don't trust you, never have. fuck typescript, fuck Windows 8, and well, fuck you.

  • by Anonymous Coward on Monday October 01, 2012 @05:28PM (#41519127)

    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.

  • by SplashMyBandit (1543257) on Monday October 01, 2012 @05:44PM (#41519289)

    I think you are missing the point. While it is good the output is 'bog standard' Javascript what really matters is that the source is not 'bog standard Javascript'. Once you start writing in TypeScript you are forever bound to Microsoft. Now there may be compatible implementations but you may get a situation like C# where Microsoft's implementation is not only the foremost, but also the only complete one.

    They did a similar trick in years past with C++, where they had so many extensions that you pretty much needed for Windows development that once you started down their C++ path, forever would it dominate your project's destiny. These days their compiler will accept 'bog standard' C++, however to get real stuff done you still have to start using Windows constructs and interfaces (due to Microsoft producing APIs that look like like 'plain vanilla' C++; as many other APIs try to do).

    As others have pointed out, "All the roads lead to Microsoft, but none lead out".

    Now Microsofties could complain that the open source proponents are whining unfairly about this and it is resticting their, "Freedom to innovate". To that I say simply this, "How about you instead spend the effort on making your browser work like everyone else's?". The amount of workarounds and hacks required to compensate for the borked and agonizingly slow way that Internet Explorer handles (what should be) cross-platform Javascript is 'criminal'. The wastage in businesses and the entire IT industry caused by handling Internet Explorer's brokenness should make them blush. Sure, innovate and make the Javascript experience the best on Microsoft tools and platforms, but don't do it by creating more 'islands' than you have already.

    As others have pointed out, TypeScript may be tech flavor-du-jour for Microsoft at the moment (since they're trying to push their mobile solutions), but just like all their other tech it will have a limited shelf-life. You are better choosing truly cross-platform and long lasting tech for building solutions on. Historical examples: C#.NET (still used widely but not getting the Microsoft focus it once did), Visual Basic, COM/DCOM, OLE, C/C++ Win32 etc etc Yes you can still develop with these, but once upon-a-time they were the shizzle promoted by Microsoft and now people have to spend their time maintaining them with old and outdated tools. Meanwhile solutions developed with Standard C/C++, Java, etc get better tools and there are code changes required to maintain them are far more minor.

    Bet your solution on the long-lived tech stacks (and increase your long-term profits!).

  • by SplashMyBandit (1543257) on Monday October 01, 2012 @05:55PM (#41519385)

    The probem isn't so much with C# the language/toolset. The problem is that in order for Microsoft to sell you new tools and tech it has to periodically change them just enough so you feel enough pain to shell out for new stuff. The other problem is that while C# is good for development it is clear that it is no longer an object of adoration in Microsoft's strategy. C# will always be around but it won't get the resources that the 'new hotness' team gets (eg. TypeScript). Meanwhile, those that use other tools (standard C++, Java etc) will keep plodding along, continuously evolving.

    If you know Aesop's Tortoise versus the Hare fable then this is what is happening now. Those who always watch the speed of the hare miss the fact that a new hare is entered into the race every few years. Meanwhile, those not distracted by the hare are watching the tortoise and see how it is less flashy but progresses continuously. If you built your tech on the tortoise you still have good solutions. If you build your tech with the hare then every few years you either have to rebuild your tech for the new hare (expensive! this is what CTOs worry about and code-monkeys don't), drop your existing investment and start building again for the new hare (expensive and wasteful), or stay with old tech (painful, and now surpassed by the tortoise).

  • by Anonymous Coward on Monday October 01, 2012 @06:02PM (#41519441)

    Exactly this. Another attempt by microsoft to comandeer a standard and lock people in as they manipulate it to be incompatible.

  • by shutdown -p now (807394) on Monday October 01, 2012 @06:31PM (#41519733) Journal

    While it is good the output is 'bog standard' Javascript what really matters is that the source is not 'bog standard Javascript'.

    Most of it is actually bog standard ES6 (for example, classes). The only proprietary bit here are type annotations. Which you can ignore altogether if you want, and then you just get a free, open-source implementation of a convenient subset of ES6 that spits out ES5.

    Anyway, this is open source (Apache license), and the implementation is itself written in TS, and runs on Node.js. In other words, it is in no way locked into any existing Microsoft technologies, completely self-sufficient, and you can fork and mod it to your heart's content, on any platform. There is no way to "extinguish" it for Microsoft from this point on, nor control you should you choose to use it, now or in the future.

  • never (Score:2, Insightful)

    by Tom (822) on Monday October 01, 2012 @06:47PM (#41519895) Homepage Journal

    Never touch anything coming from Microsoft unless you plan to sell out wholesale.

    If you're an MS shop anyways, then do whatever you want. But if you are not, you should've learnt by now that everything they make is lock-in, bait-and-switch or some other trickery.

    Name a counterexample. Pick one that has been around for a while, because they do have a long breath and sometimes give you several years to really bet the farm on their technology before springing the trap.

  • by Anonymous Coward on Monday October 01, 2012 @07:21PM (#41520167)

    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.

  • by jbolden (176878) on Monday October 01, 2012 @11:02PM (#41521607) Homepage

    research.microsoft.com has been advancing lots of open source functional languages that use type inference and no one has been getting burned. The research group lets them do cutting edge research and then another research group builds an implementation for more mainstream languages and then it gets pulled in by product management.

    So I'd say in the open source language arena the public has learned the opposite.
    I'll agree it is different with products as opposed to technologies.

  • by strikethree (811449) on Tuesday October 02, 2012 @12:24AM (#41521953) Journal

    Microsoft ALWAYS has a plan to manipulate things or outright control things. It is not unreasonable at all to be suspicious of this too, even if there is no currently visible way that anything underhanded could be done. Act offended if you want but not very many people will care.

  • by FirephoxRising (2033058) on Tuesday October 02, 2012 @12:33AM (#41521985)
    Yet. They're at the Embrace stage, how long until you have to use their "optional" extras, or it breaks something, or even throws up a harmless error that freaks bosses out. Remember the DR DOS windows error?
  • by exomondo (1725132) on Tuesday October 02, 2012 @01:01AM (#41522071)

    He means in the 'dictating policy and direction' way.

    But that wouldn't make sense because the beauty of open source is that if you don't like the direction that the project steward is taking it in you can just fork it, simple.

  • by cant_get_a_good_nick (172131) on Tuesday October 02, 2012 @10:25AM (#41526257)

    He means in the 'dictating policy and direction' way.

    People here forget the concept of Opportunity Cost. Everything costs you some resource: Time, money, brain nurons, carbohydrate energy in your blood, at least something.

    I use a simple text editor because I don't want to learn Emacs. I don't decry the tyranny of Emacs, of the evilness that is Stallman locking me into a particular set of key sequences. Oh my deity! Stallman is dictating policy and direction for my text editor!! I just say "I don't want to spend my energy there".

    Everything pushes you to a direction. Microsoft does. JavaScript does. ECMAscript does. C does. C++ does. Scheme does. If you're worried that the direction Microsoft pushes you leads to a bad path, fine. But don't kid yourself that by choosing something else that you're no longer being pushed.

I don't have any use for bodyguards, but I do have a specific use for two highly trained certified public accountants. -- Elvis Presley

Working...