TypeScript: Microsoft's Replacement For JavaScript 488
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).
Embrace, Extend, Extinguish (Score:2, Insightful)
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!
Re: (Score:2)
How exactly do you "extinguish" something that's free, open source and cross-platform from the get go?
(yes, TypeScript is all three)
Re: (Score:3)
That still doesn't make any sense. There's no implementation to install here - TypeScript compiler outputs portable, standards-compliant JavaScript code that runs the same on any browser (and also Node.js etc).
Re: (Score:3, Insightful)
Um, the Apache License is significantly more free than the GPL. Just sayin'.
Re: (Score:2)
For varying perspectives on what constitutes "free."
Re: (Score:2)
nearly sane.
What are google's two js replacements? (Score:5, Interesting)
Dart, obviously. But what is the other one? Anyone know what the article writer was talking about?
Re: (Score:3, Informative)
Clojure: http://clojure.org/ [clojure.org]
Don't think it's formally Google anymore.
Re: (Score:2)
Clojure is pretty cool, and it compiles to the JVM code, but I have never heard about it being a replacement for JavaScript. In which sense would it replace JavaScript?
Re: (Score:2)
Id say GWT if i had to guess.
Many options, all wrong (Score:3)
Probably one of Go, Closure, Java (via GWT), or C (via NaCl), though I suppose one might see Python and (again) Java (this time, via AppEngine) as "replacements" for server-side JavaScript in the form of Node.js, though that's even a bigger stretch than the others. Dart is the only one that is actually an effort in the direction of a general JavaScript replacement, though.
Re: (Score:2)
I don't think that qualifies as a language, but maybe that's what the author meant.
Re: (Score:2)
Go is meant as a system language.
I don't think complexity has anything to do with it.
But maybe the author meant C, in the form of Google NaCl (Native Client).
Re: (Score:2)
Yeah, that's probably it. Always forget about salt.
Re: (Score:3)
CoffeeScript isn't a google creation. As another poster pointed out, its probably NaCl.
I am still busy with silverlight (Score:5, Funny)
Sorry..
I am still busy with silverlight...
Oooppss. that did not work....
Re: (Score:3, Funny)
In related news, I just released a game in HyperCard.
CoffeeScript, Dart and this - screw it all (Score:5, Insightful)
Fix JavaScript or give us something like Python minus the dangerous bits in the browser.
Re:CoffeeScript, Dart and this - screw it all (Score:4, Interesting)
Obligatory: http://xkcd.com/927/ [xkcd.com]
Note: please do not mod this post up. Yes, it is completely relevant, and funny, but I can't take credit for it. :p (On the other hand, I request it not get modded down just because you don't like xkcd, either. Relatedly, why the frell don't you?)
Re: (Score:2)
You know you could always post as an AC
Re: (Score:2)
No, I just totally forgot about it. I never post AC, mostly because I forget about it every time there's a reason I might want to, which is rarely enough that I am going to keep forgetting about it. :p
Re:CoffeeScript, Dart and this - screw it all (Score:5, Funny)
Yeah, well, you sound like a... person who... isn't very good at comebacks.
Also, your mom.
Re: (Score:3)
You could definitely benefit from attending Simile School [youtube.com].
Do you have a karma allergy? (Score:5, Funny)
Obligatory: http://xkcd.com/927/ [xkcd.com]
Note: please do not mod this post up.
Note: please do mod this post up
Re: (Score:3, Insightful)
It makes me cry whenever I hear JavaScript being used as an 'assembler'.
CPU performance, memory usage, and power consumption be damned!
Re: (Score:3)
"looking for transpiler: php to javascript" - http://stackoverflow.com/questions/1995362/looking-for-transpiler-php-to-javascript [stackoverflow.com]
And it would appear someone is working on a PHP to JS compiler. http://www.harmony-framework.com/ [harmony-framework.com]
Re:CoffeeScript, Dart and this - screw it all (Score:4, Informative)
Re:CoffeeScript, Dart and this - screw it all (Score:4, Insightful)
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:
(LLVM bytecode is NOT suitable for this; it is first and foremost a compiler IR, and is not intended for cross-platform use.)
Re: (Score:2)
Re: (Score:2)
Something like Python? I thought you wanted something better?
Re: (Score:2)
"This is not a solution. It's a mess."
Indeed. These companies are not creating JavaScript replacements because they just want it their way, there are real issues with using JavaScript for large developments. Why are we still waiting for basic features like optional static typing and classes to be added to JavaScript? Static typing is a very important feature. From it flows not just basic type checking, but also autocompletion (a major productivity booster), ease of re-factoring and useful code analysis (what functions use this particular type
The problem is not with Javascript (Score:5, Interesting)
Javascript works well for what it was intended to do: adding dynamic functionality to webpages. It only has problems when it's used for something it was not intended to do like building web-based applications or the Flash-like animations of HTML5. These are very different use cases, and I don't think one language to cover them all is a good idea. Developing new languages for the new web technologies is the way to go.
Re: (Score:2)
Re: (Score:2)
Re: (Score:3)
It's cool to hate javascript. Hence, all the sheep repeating the meme -- hence the lack of specifics. In reality, js is fairly painless to use and, once you know what to avoid, you can use it to write some nice clean and maintainable code.
Here's the weird part. While it's cool to hate javascript it's also cool to love jQuery. Weird, as all it does is make your code less efficient, less readable, and more difficult to maintain. (Abuse of jQuery abounds -- I've seen it included to do astonishingly simpl
Re: (Score:2)
Re: (Score:2)
Re:CoffeeScript, Dart and this - screw it all (Score:4, Informative)
Well, gaming consoles run JavaScript (in their browsers, or at least the Xbox will at some point), and most of them (PS3 being the exception) don't run Java.
Smartphones run Javascript, while even Android doesn't really run Java (there are a few niche platforms that do, though).
Every single PC has at least one, and probably quite a few, javascript engines (Windows ships with at least two: the one in IE and Windows Script Host). Neither Windows nor OS X ships with Java anymore.
Aside from Windows-NT-based ones (again, Android doesn't count), I don't know of a single tablet that can run Java. They all support Javascript, though.
Many dumbphones can run (a subset of) Java, but these days many of them can run Javascript too.
Nearly all of the larget Personal Media Players of recent years can run Javascript; I don't know of any that run Java.
In absolute numbers, I don't know what the balance is. However, in terms of the way that customers interact with their devices, Javascript is a lot more widely used than Java.
Re: (Score:2)
Re: (Score:2)
I think TypeScript should be forked and renamed to Douche# to better fit in Microsoft's pantheon of languages.
They made their Java clone, now they have their Dart clone and they're written by the same guy!
I like the not so subtle FUD... (Score:2, Informative)
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.
Lol, how cute. You're trying to create FUD.
Re: (Score:3)
I do think CoffeeScript is pretty compelling, though I'm not sure how much I like it... a lot of what's in TypeScript is based on efforts with EcmaScript in the past/future, so it lines up a little better. I think there's room for CoffeeScript, Haxe and TypeScript. TS will probably get a bit more tra
Aside from Microsoft's history.... (Score:5, Interesting)
Re:Aside from Microsoft's history.... (Score:4, Informative)
Exactly, it's basically a preprocessor for javascript that allows your IDE to help you write better code.
Re: (Score:2)
0 day exploit found in TypeScript (Score:5, Funny)
I'm going to leave this here as a placeholder for the inevitable...
Oh FFS (Score:2)
We already have, what, a couple *hundred* languages to choose from at this point?
https://en.wikipedia.org/wiki/List_of_programming_languages [wikipedia.org]
Can we knock it off with the new effing languages already? Don't these people have anything more useful to do?
Re: (Score:2)
We already have, what, a couple *hundred* languages to choose from at this point?
Almost as many as we have Linux distros!
Re: (Score:2)
Yeah people! Stop thinking about new ways of doing things! Get in line with the One True Way!
Article title misleading. (Score:2, Informative)
It doesn't replace anything. Its simply a higher level language that compiles to cross-compatible JS. And its open standard to boot.
Not seeing any negatives about it. JS is a mess and MS is attempting to clean it up.
I'd rather use Script# (Score:2)
to compile my C# algorithms to Javascript. See http://scriptsharp.com/ [scriptsharp.com]. It's by a Microsoft guy so hopefully it gets official support some day.
all these languages what am I to do? (Score:2, Insightful)
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.
Re:all these languages what am I to do? (Score:4, Informative)
c? to write client-side code run by the browser?
are you high?
Re: (Score:3)
Sticking with C.
And now you don't have to be left out of the web page revolution... Check out https://github.com/kripken/emscripten/wiki [github.com] which is a LLVM backend for javascript. They have ported a big portion of the standard C libraries, STL, and a number of other things. Its pretty funny, but you can run boat loads of old emulators, games, you name it in a browser now.
I find this useful, ignore the FUD! (Score:2)
As a cocoa programmer tasked with implementing yet another embedded htmlfucking5 project thanks to Adobe Edge, I wish Javascript would die.
After looking at the myriad of patterns for my current project - a Javascript client REST API - I came to the swift conclusion that most of them are silly, namespace polluting, self initializing mindfucks. I gave up looking at patterns, found a preloader (lab.js - although require.js is looking good) and wrote my own module pattern objects to satisfy the clarity, structu
Playground seems borked (Score:2)
Re: (Score:2)
Obviously by design.
I call for web byte-code (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 [jquery.com] 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.
Re: (Score:3)
The problem with adding any new language is that it requires support from all browsers to be at all useful.
I don't think that's necessarily true.
Think about a near-future world in which Chrome -- and only Chrome -- has a Dart VM, and suppose that Google's dream of Dart bytecodes being an order of magnitude faster to download and running an order of magnitude faster is realized. Google will then invest in writing all of their web apps in Dart, using the generated Javascript code in browsers that don't support Dart but running Dart bytecodes wherever possible. End result: Google's web apps are an order of mag
Re: (Score:2, Insightful)
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.
Re: (Score:3)
Re:DEFINITELY No!!! (Score:5, Insightful)
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).
Re: (Score:2)
Re: (Score:2)
Look at the incompatibilities introduced by their past technologies: C# (copycat from Java) and simply calling it C#
You might as well whinge that Java is an incompatible copycat of Delphi, C# was never meant to be compatible with Java in any way, or do you not have any understanding of what C# is? The lack of cross-platform is the killer for C# (yes there is Mono but it's never up to the same version as the MS CLR).
Web Form (.NET 2.0)
What are you suggesting it was supposed to be compatible with?
Active Directory (vs LDAP).
Again, Active Directory and LDAP were never meant to be compatible.
If you want to jump on the anti-microsoft bandwagon at least try and write a po
Re: (Score:2)
I'm positive that when Microsoft hired Anders they uttered a sentence like "We want to clone Java so it only runs on Windows."
And then .Net was born.
Re:Remember the old addage (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.
Re: (Score:3)
Re:Remember the old addage (Score:4, Insightful)
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!).
Re:Remember the old addage (Score:5, Informative)
Once you start writing in TypeScript you are forever bound to Microsoft.
I see you're unfamiliar with the concept of open source: git clone https://git01.codeplex.com/typescript [codeplex.com]
Re:Remember the old addage (Score:4, Insightful)
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.
Re:Remember the old addage (Score:4, Insightful)
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.
Re: (Score:3)
And how about patents? Would you bet against me if I said that Microsoft had a bunch of patents pending related to TypeScript?
They released it under the Apache 2.0 license so patents aren't an issue, moreover typescript just emits javascript so the end result that is actually used is just plain javascript anyway.
Re: (Score:2)
I suck at editing:
s/due to Microsoft producing APIs that look like like 'plain vanilla' C++/due to Microsoft producing not APIs that look like like 'plain vanilla' C++/
Re:Remember the old addage (Score:4, Insightful)
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.
Re: (Score:3)
You cannot ignore the annotations if the majority of libraries you are attempting to use are 'tainted' with them.
Sure you can. You just run the TS compiler on them, get JS output, and stick to that. It's quite intentionally outputting well-formatted JS that very closely mimicks the original code - to the point where language spec itself defines how exactly transformation happens. Right now it's not comment-preserving, but they intend to change that, too. This all will work much better once they start targeting ES6 directly, rather than ES5.
Also note that annotations are purely compile time hints (for warnings, IDE too
Re: (Score:3)
The type annotations/inferences are features that would have been in ES3, had it not been tanked by committee.
Re: (Score:3)
Re:Remember the old addage (Score:4, Informative)
Re: (Score:3)
If you're going to criticize something, at least get your facts straight. The C# yield keyword has nothing to do with Thread.yield(), it's for easier implementation of lazy iterators. And there is a very good reason why it is a feature of the language: it actually changes how the method behaves at a fairly deep level. Upon hitting the yield keyword, execution leaves the method and returns there only when another item from the iterator is requested. That's why it can't be just a library.
Re: (Score:2)
Frankly, If Microsoft can Extinguish the JavaScipt Name I'm all for it.
I'm sick of explaining to everyone on earth that Javascript is NOT Java when I tell them they should get rid of the Virus targeted Java Runtime they do not need or updated in three years, but have on their machine just waiting for the next drive by virus to say hello.
Re: (Score:3)
Just keep calling it "ECMA Script" until it sticks.
Good luck.
Re:Remember the old addage (Score:5, Funny)
Just keep calling it "ECMA Script" until it sticks.
For some reason, "ECMA" always makes me think of "ACNE". Now it will for you, too ;-)
You're welcome.
Re:Remember the old addage (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.
Re: (Score:3)
Re: (Score:2, Insightful)
Exactly this. Another attempt by microsoft to comandeer a standard and lock people in as they manipulate it to be incompatible.
Re:Remember the old addage (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.
Re: (Score:3)
Rather, it seems MS is trying desperately to become more relevant and trustworthy in the open source space. So much so that they will toss their hat in the ring any chance they get.
Javascript seems like a good opportunity, if you're looking at it from their perspective.
Re:Remember the old addage (Score:4, Insightful)
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.
Re: (Score:2)
if prototypical inheritance is so great, why does almost everyone write a class-like wrapper around it to make it useful?
Re: (Score:2)
if prototypical inheritance is so great, why does almost everyone write a class-like wrapper around it to make it useful?
Probably because they haven't read this. [crockford.com]
Re: (Score:2)
ugh, Crockford considered harmful.
1) it's not compatible with ES5.
2) it doesn't handle overridden methods/constructor
3) you can't efficiently & cleanly get private/protected members
4) it misses the point, just because you can do all these clever things with prototypes doesn't mean that you should.
exposing the mechanics of all this stuff to the programmer is a disaster - it results in reams of confused questions on stackoverflow, and tools that need to solve the halting problem.
Re: (Score:2)
Or they read the first three paragraphs and go "I don't get it and I want to use OO like those C++ guys" and deliberately choose to ignore probably the most useful aspect of JavaScript.
Re: (Score:2)
it may be the 'probably the most useful aspect', but it's still a leak of the implementation details of a half-baked feature.
how many of 'those C++ guys' are raving about how cool it is to mainpulate **this in your constructor? none. why not? because it's foolish and the language already provides rich abstractions for many of the sensible things you could do there, and more importantly prevents you from doing most of the idiotic things. same reason most of the 'compile-to-javascript' languages, as3, JIT eng
Re: (Score:3)
Re: (Score:2)
i fail to see how any of that has anything to do with or is limited to prototype chains, except maybe performance where it can only hurt.
function programming techniques don't require prototype-based inheritance.
event driven callbacks, async, neither.
Re:Full classes? (Score:4, Informative)
Doesn't JavaScript have a better system altogether? Prototypical inheritance? Classes feel awful in comparison.
These classes are just syntactic sugar, and are fully defined in terms of prototypes and constructor functions. The exact translation is detailed in the language spec, but it's easier to just go here [typescriptlang.org] and see how exactly it maps TS code to JS code, live, as you type it. Here's a simple example with inheritance
translates as follows:
As you can see, it's all fairly idiomatic JS.
Furthermore:
And doesn't the next revision have support for classes? I keep forgetting the name of it, H s... oh Harmony?
I'm sure Harmony has a lot of things planned to extend the language massively to bring it up to standards even comparable to other languages.
Indeed it does, and TypeScript classes are directly borrowed from there. Furthermore, the team has said that they will keep tracking ES6 (since it's still a draft), and amending TS accordingly so that their class syntax and semantics remain in sync.
Re: (Score:3, Informative)
v8 (and other optimized JavaScript implementations) have decent performance despite JavaScript the language.
Re:Full classes? (Score:4, Informative)
I know a little bit about compilers.
"Every number is a float" is one of them in JavaScript. "All objects are associative arrays" is another. "Object prototypes are mutable everywhere" is yet another.
Some, yes, but many also come from tracing the flow of data as the program runs to figure out which pessimizations inherent to the semantics of JavaScript it's safe to undo. That's why modern JavaScript JITs work so hard to perform side exits with their guard clauses to produce code that runs in as straight a line as possible. Ask Jim Blandy about it sometime.
Perl would have to do similar optimizations. So would Python. So would Ruby. (It's instructive to talk to the people behind Rubinius and Unladen Swallow, if not people who've spent years optimizing Smalltalk implementations.)
VS2012 as Node.js dev choice... (Score:2)
Re: (Score:3)
Beyond that, this is a lot different. This is a set of declarative extensions to JS that lean towards the next version of the standard and act as a pre-processor straight to JS proper. Not o