What...
.... could possibly go wrong?
Microsoft has released a new JavaScript development environment, dubbed TypeScript, and says it is designed to help developers write more complex apps with the popular scripting language. Long-time Reg readers may recall that Microsoft has form giving the world new technologies, but not always for altruistic reasons. During …
This post has been deleted by its author
Telegram for Mr.Kettle from Mrs.Pot.
Please explain? I tried TypeScript and took a good look at what it is and what it does last night (because a large part of the architecture I'm working on at the moment requires Javascript and it'd be nice if it were more managable).
Your comment indicates some hypocrisy has occurred, so please let me know where.
And if you can, please also point an article on the Register about a Microsoft technology that receives 75% or greater positive comments. And if you find one, take a picture of the unicorn it's stapled to.
Hell, MS even get hate for taking down botnets here. It's gone beyond petty and turned into some kind of belief system.
"Please explain?"
I'll try...
"I tried TypeScript and took a good look at what it is and what it does last night (because a large part of the architecture I'm working on at the moment requires Javascript and it'd be nice if it were more managable)."
That's fine - I wasn't making any comment about TypeScript however.
"Your comment indicates some hypocrisy has occurred, so please let me know where."
Your characterization of peoples reason for not giving a positive response was a cliched over-generalisation, and at odds with the responses on here - there were some stupid nay-sayers sure, but also, e.g. some others questioning the need for OO, some questioning motives (fair enough given the history - this are changing at Microsoft, but you have to earn trust as they say.. and for some they don't have enough credit yet) and so on. In short, i'm not seeing the vitriol or reason for not liking TypeScript you seem to be implying. Hence you seem to be falling in the stereotype you put forward for others.
"Hell, MS even get hate for taking down botnets here. It's gone beyond petty and turned into some kind of belief system."
Really ? I've not seem any significant 'hate' for that, quite the opposite.
It's a library that compiles code to javascript. If you have ever worked seriously with javascript, getting code you've written yourself to work correctly across all major browsers is a pain in the arse.
Getting javascript code that has been written by a machine to work correctly across all major browsers is going to be a pain in the arse that repeats every time you change the original 'TypeScript' and recompile.
Besides which, we all know javascript by now. It's not that hard to write unobtrusive, elegant JS, so why stick an obfuscation layer in between?
Yes, admittedly I can see a scenario where you just *cannot* make the scompiler produce the code you want, but I guess that depends on what parts of what is generated is non-browser compatible. ost of what you write (in theory!) is going to be plain ol' Javascript, and that should (in theory!) make it no *harder* to write for compatibility.
Of course it won't be any *easier* either...
"Getting javascript code that has been written by a machine to work correctly across all major browsers is going to be a pain in the arse that repeats every time you change the original 'TypeScript' and recompile."
I disagree. If I have to pay attention to differences between browsers, I'm going to forget something or miss something. If I can let Microsoft take care or a translation system that will take care of any differences itself, and this system is in use by millions of people so that any problems or errors are found and fixed very quickly, it's going to be far less of a hassle to me as a programmer.
"Besides which, we all know javascript by now. It's not that hard to write unobtrusive, elegant JS, so why stick an obfuscation layer in between?"
If you don't see how much easier it can be to develop large web-based applications with actual classes, structures, being able to develop an IDE (as MS have) which respects variable types even though Javascript does not and other features, then you've probably never worked with more serious languages such as Java, C++, Python, etc. Bringing *some* of the power of that to Javascript, definitely makes things much easier. There's no question about that.
Utter tosh. You can develop class based JS applications perfectly fine in JS right now, no external tools required.
Personally, I don't think developing in an IDE is the epitome of sophistication, I don't think compiling one language into another interpreted language* that runs on a variety of interpreters is a particularly effective way of mastering incompatibilities between those interpreters, and I definitely will not want ever to debug javascript issues emanating from auto generated code.
I'll pass on your ad hominem quips; I develop daily in C, C++ and Python, thankfully haven't had to use anything Java related in 12 years.
* However, when the language compiled to is only used as an intermediate, and immediately re-compiled against a single backend, this is an exceptionally good pattern. For instance, clang++ will first translate C++ into C, which is then immediately compiled into object code.
"Utter tosh. You can develop class based JS applications perfectly fine in JS right now, no external tools required."
No, I don't think you can. Everything in Javascript is an object, but that doesn't mean you can develop class based code in pure Javascript. Scope? Inheritance? There's no Class keyword in Javascript. Creating a function and pretending it is a class is not a substitute. You're wrong to say "utter tosh". Trying to say that Javascript supports OOAD / Class-based applications is rubbish. There are some very loose, partial work-arounds that were never intended by the designers and which omit fundamental elements of class based design.
"I definitely will not want ever to debug javascript issues emanating from auto generated code."
And yet you say that you daily develop in C++ and Python. Do you not also reject these because you don't want to have to debug the intermediary C code that both generate during compile? Same principle and assuming that TypeScript does what it says (and it's a lot simpler than a C++ or Python compiler), then the same in practice, too.
It's not even close to the same principle:
GCC compiles C++ straight to object code.
Debugging C++ using GDB or similar does not have you examining some generated C code, you step through C++ statements.
Python does not 'generate intermediary C code', it generates python bytecode which runs on a singly specified C python interpreter.
clang++ does translate C++ to C prior to compiling it to object code, but it translates it to only be compiled by clang - it does not generate C which it expects icc, gcc or bcc to compile.
A frontend generating code to be used by it's coupled backend == good, a frontend generating code to be used by unrelated backends that do not strictly conform to any standards == bad. Do you need diagrams, or have you got it yet?
And yes, it is a real fucking pain in the arse when you write valid python code, run it on the python interpreter, and end up having to debug the python interpreter. Fortunately, this almost never happens, since the bytecode compiler and the interpreter are tightly coupled. which they aren't in TypeScript.
So perhaps there is some use for this tool. Some flawed minds can seemingly only cope with "OOP == Java" mindset, and this allows them to master the difficulties that are javascript. Or for those shops that previously would use a nice ActiveX control to ensure lock in, here is another bit of technology that will make your clients either come back to only you for improvements, or re-do the entire project from scratch. I was too harsh! And you can do it in an IDE?! Whatever will these clever guys think of next.
http://www.digital-web.com/articles/scope_in_javascript/ - scope in Javascript
http://phrogz.net/JS/classes/OOPinJS2.html - inheritance in Javascript.
Both pages are 6+ years old. Javascript has been able to do this since before the days of IE6.
Just because it doesn't have a thing called a "class" doesn't mean it's lacking these two...it was developed as an OO scripting language right from the start.
@Tom 38: Utter tosh. You can develop class based JS applications perfectly fine in JS right now, no external tools required.
Let's accept, for the sake of argument, that you, as a superior being, can do so. Now think about the junior developers who seem to be in the majority on an average team. People who mostly got into programming because they thought it would pay well, who have scant knowledge of how the language they're using works, and little enthusiasm for finding out. With a robust, strongly-typed language these developers stand a fair chance of turning out code that does what is required and doesn't do lots of other things that aren't required. JavaScript, fine language though it is, has far too many nasty little traps to be suitable.
I definitely will not want ever to debug javascript issues emanating from auto generated code
These days, anything but the most trivial scripts are "compiled" (i.e. compressed and obfuscated) before deployment. You can only debug these with tools that relate the deployed code to the original script. I don't know about TypeScript, but I would expect any compile-to-JS platform to include this feature by default.
Personally, I don't think developing in an IDE is the epitome of sophistication
Yeah. Real men write their programs using vi/emacs/edlin/edt/whatever, and compile them by keying in the opcodes. Nice to hear the old ones again.
> If I can let Microsoft take care or a translation system
And that's the big "if"...
On the face of it, this seems to be a Good Thing(tm) for all the reasons you state. The worry I would have is whether the cross-browser stuff actually works properly - will MS write stuff the works as well for Firefox as it does for IE, or will one platform get a little extra love?
If MS do a good job on the browser-neutrality front, TypeScript could be a really god thing. If it produces borked code for anything except IE, it is worse than useless. I'll wait until I've actually tried it before drawing any conclusions...
Vic.
"And that's the big "if"..."
I don't think it's a big 'if'. Maybe time will prove me wrong but there are two components to that 'if'. Technical ability and good will. For the technical requirements, MS already manage vastly more complicated projects fine. The TalkScript to Javascript compiler is far, far less complicated than even just a VB compiler. And you get bugs in compiled code, but it's very rare that they're due to the compiler rather than the programmer. So that leaves good will. The advantage with the latter is that this has been released free and open. MS can be kept honest by the fact that others can implement it as well. As was pointed out elsewhere, there's nothing to stop Eclipse making a TypeScript plugin for their IDE for example. So we have a solid insurance policy. If MS want this to be successful, and they surely do, then they want it to work well in all browsers otherwise it will hurt uptake.
Time could prove me wrong, but there are strong arguments that we should be safe on this. IMO.
"I disagree. If I have to pay attention to differences between browsers, I'm going to forget something or miss something. If I can let Microsoft take care or a translation system that will take care of any differences itself, and this system is in use by millions of people so that any problems or errors are found and fixed very quickly, it's going to be far less of a hassle to me as a programmer."
Microsoft has such a great rich history of that. They browser sniff to disable the use of other browsers. How many times have they done that? Plenty of times. They settle with the EU in that they would give the users a screen of other browsers to use. Care to guess what happened after a SP; yep, the screen was no longer there.
"It's not that hard to write unobtrusive, elegant JS, so why stick an obfuscation layer in between?"
Depends what you're doing. For the small stuff it's fine, if you're doing large frameworks (not necessarily web-based; js is a general purpose language) of several thousand lines then you have to be *obsessive* about putting type-checking assertions in absobloodylutely everywhere. And that's run-time of course so you can never be sure you've found them all.
A static tool to do this would be a godsend, depending. If it does type inferencing to give the flexibility of run-time typing with compile-time safety, marvellous. I'll have to take a look.
What I'd like to see is a proper js or whatever compiler with this stuff built in so the static typing guarantees could be propagated into code as optimisations (= faster code & a simpler compiler). Obviously you can't do that nearly as well if your target is jscript.
That it's produced by MS, whether open and forkable or not, gives me some unease though. I've had too much experience with them to trust them any more.
@dogged: "It's Microsoft, therefore it's foul and evil and wicked"
How long have you worked in software development? I'm guessing not long enough to know why the author says, "...readers may recall that Microsoft has form giving the world new technologies, but not always for altruistic reasons".
That's an understatement. As an example, ever wondered why so many companies persist in using IE6 internally? Microsoft took the standards underpinning the Web and "made them better". What that amounted to was a view of the Internet that only looked right through MS technology. It ended up biting everyone because even MS can't support its own distorted 'standards' indefinitely, and the companies/goverments that bought into it are looking at a huge bill for digging themselves out again.
If you're a developer, do yourself (and your client) a big favour and stick to standards. Don't get caught in the "standards-plus" trap - it will cost you dearly to escape.
How long have you worked in software development?
Seventeen years. Shit, where did the time go?
And yes, as commented above, I know exactly how bad things used to be. And how bad they're not any more. It's useful to be able to retain a sense of distance and not take things personally. For example, all American TV used to be shit. Now I'm pressed to find enough time to watch Breaking Bad, Boardwalk Empire and Sons of Anarchy and there are several others I hope to try when I get some time off.
If we all went around thinking "All Microsoft products are shit all the time and they are evil and I hate them because IE6 was fucking awful (which I'm not arguing, by the way) and Steve Ballmer once said a mean thing about linux" we'd be as stupid as Eadon or Bob Vistakin.
A good tool doesn't stop being a good tool just because it says "Microsoft" on it. An open source product doesn't become a closed source product because it was written in Redmond.
If MS try to close TypeScript, I will personally fork it and leave the latest open version on Github. But I doubt very much that they will. Playing the game the old way clearly doesn't produce as much revenue as playing it the new way.
If you're a developer, do yourself (and your client) a big favour and stick to standards. Don't get caught in the "standards-plus" trap - it will cost you dearly to escape.
What, like Ajax, that non-standards-compliant addition to the browser by Microsoft that, oh I don't know, made the whole Web 2.0 revolution possible?
Standards are only worth following as long as they are not enforcing technological stagnation.
mmm...
lack of standards compliance generally, and Microsoft's active role in undermining open document standards in particular;
the organisation responsible for IE6
do you remember visual basic version upgrades that reversed logical operators?
BSODding
withdrawing a product because they get bored with it
activex
.net
the trumpeting in advance of the release of Vista
the general never buy v1.0 of any Microsoft product wisdom
Microsoft have the best over all development language and development tools products over a long long history than any vendor by miles, so probably not a lot...
I would cite Powershell as an example - far more powerful than the legacy shell scripting languages that were the only previous comparable option, and fully object orientated - developed from scratch - and being rapidly adopted all over the place. For instance by VMWare for ESXi.
MS have made some major blunders in programming languages (although I'll grant you that their IDEs are always excellent). JScript, MFCs, ActiveX components, VBScript, others. Personally, I think VB should have been strangled at birth but opinions vary on that one.
Incompatabilities and weird behaviours have been fairly rife over the years.
However, since roughly 2008, this seems to be deprecated behaviour. Since then, they've been solidly aiming for cross-compatibility and standards compliance. I suspect Hejlsberg has a lot to do with this.
It's a good trait and I hope it continues.
"Because they just released VS2012, and it's as stupid as shit to look at as Metro was, and this toolkit only works on 2012."
You don't have to use VS2012 to write this. It's just nice to do so. You can download a commandline TypeScript compiler. It's already right there on the Download page for TypeScript. You didn't even bother to check before you posted the above misinformation. And it's open and free so there's no reason at all that an IDE based on TypeScript can't be built for Eclipse or anything else.
It's about averages, not what is possible.
Microsoft have just been passed by Google. This is because they get endless feedback from techies, and then marketing ignores it.
They describe google as more innovative, which it is, and then at Redmond, some marketing bod, says "Look we need to be more innovative. Make me something like that."
I'm truly depressed at how little they pay attention to obviously correct feedback. After marketing have screwed major pensions out of the company, they'll move on.
It's a real tragedy, but the techies I know are still brilliant, but the direction they get is just stupid as sh*t. They have people with IQs of a hundred, dictating what people with IQs of 150 should be doing.
"says "Look we need to be more innovative. Make me something like that.""
Feature for feature, TypeScript knocks CoffeeScript all over the place. Dart I'm not very familiar with but that's a very different principle. With TypeScript you have instant compatability with any browser that does Javascript.
This post has been deleted by its author
Remember that MS's definition of "open" is not our definition of "open". The Office XML standards are "open" and yet infected with patents that prevent an open implementation (just one example).
Only a dribbling moron would use any MS tech without the understanding that they will be locked-in to that vendor.
@Big Yin: How do you think the GPL works? I am not totally free to implement anything covered by the GPL because it is protected by patents. If I want to implement from the GPL, I have to copyleft amongst other things, that is a restriction on my freedom to use the code covered by GPL.
There are other FOSS licences where you have to hand over a pint to the author, or you can use the code if it's "not for evil" (I kid you not) others where you have to be vegetarian, or send a postcard to the author, all of these are restrictions on how the code it used.
"There are other FOSS licences where you have to hand over a pint to the author, or you can use the code if it's 'not for evil' (I kid you not) others where you have to be vegetarian, or send a postcard to the author" -- these licences (citation pls? kthx) would fail to meet the Open Source definition. A requirement to be a vegetarian would contravene clause 5; a requirement not to use the code for evil would contravene clause 6.
... which means this is just yet another language only appropriate for making crappy web-apps.
Shame really. I'd love to see simple language with great support for both generic and functional programming, and with APIs rich enough to teach kids game programming. Mission impossible, perhaps?
This post has been deleted by its author
In my experience: yes. One might get twatted, by means of imbibing a large quantity of alcohol. An individual might also twat another, generally involving fisticuffs but occasionally improvised weaponry.
I have not encountered it as a gerund ('twatting'). Make of that what you will.
That's a present participle, not a gerund. (Although the construction in English is the same.)
On the other hand, "People who don't know what a gerund is need a good twatting" is an example of using "twatting" as a gerund; here it is used as a noun which implies the verb "to twat".
The best thing about English is that it changes a develops and we don't have a situation like the various other European countries where our language is set in stone by a handful of academics who have no experience in using anything other than the RP version on Queen's English from circa 1950.
New words and new uses for words is a good thing.
@Mrfill, some things that develop in language grate with me, others grate at the time and then are fine, others just seem fine. I do think that there's a lot of grumpy old man about protestations about changes - and I do see it in myself too...
By the way "It is weird." is a sentence fragment, probably not brilliant in an argument about poor grammar, spelling and syntax. ;)
Architected. Architected. Architected.
There I said it three times now, try not to choke. And I don't really care what baby Jesus does.
"Designed" doesn't cut it for software. "Design" relates to look and feel these days, hence "Graphic Designer" or "UI Design" and "build" means another thing entirely (besides, I'm sure Anders didn't build this himself).
If you were to show someone a piece of software (I'm assuming from your Nick that you know a bit about this) and say that you designed it they would say "That's very pretty. Who was the architect?". Hence, bad suggestion.
Besides, as others have pointed out - it's a perfectly valid verb. OED. Maybe you need to organize* your bookshelf, move the dictionary to the front....
(* - also valid, deal with that too!)
There are at least three major js compilers now. This, dart and coffeescript.
None of them should be even be necessary but if you really must write javascript in another language you should probably stick with the original (coffeescript) and don't support the MS vs Google masturbation contest.
The JS community seems to be chock full of NIH developers.
"Standards based appraoches always take far too long. Better to deviate a little for a time then come back into the fold."
Unfortunately Microsoft has a (not totally undeserved) reputation for the 'come back to the fold' bit being the exception rather than the rule. Times are changing, and changing radically in some divisions, but some of us have memories that go back a way...
Not to mention the classic 'Come back to the fold then depart from it' strategy. Or the 'Invite everyone into the fold but hide a few things from them' strategy.
There was a sweet spot about five to ten years ago when everything seemed to just work - at least on the Windows platform. A golden age of 'Download, install, run, win'. Now we seem to be re-entering the world of 'Download, faff around, download the right thing, install, faff around, download something else, faff around, run, get annoyed.'. Hopefully it's just another IT cycle and in ten years we'll be back to smooth sailing.
Oink oink, flap flap.
Yes, I agree there was a time when MS had to do what it needed to. However, over a decade later I think MS is a much better organization when it comes to standards. It's not a rebellious teenager anymore. Microsoft should be supported for making the efforts, but there will always be an element of competition, they are after all a business, not a charity.
Commerce can occasionally drive standards better than a committee.
"A golden age of 'Download, install, run, win'. Now we seem to be re-entering the world of 'Download, faff around, download the right thing, install, faff around, download something else, faff around, run, get annoyed.'. Hopefully it's just another IT cycle and in ten years we'll be back to smooth sailing."
Cycle? Well, no. Get away from Windows to an OS with a proper package manager and this is simply not a problem. I've been in this "golden age" since I switched away from slackware well over 10 years ago. Ubuntu, I install whatever software I want off of synaptic, click "install". If I get a seperate .deb package, I click install. It takes care of installing any other junk I may need. On my couple gentoo boxes, when I tell them to emerge (i.e. install) a new program, the *computer* may faff about endlessly compiling, but *I* don't -- portage also figures out what additional software (if any) has to be installed and takes care of it for me.
That said... Windows (at the point of XP or so) was an absolutely hellish mess, someone did a dependency graph for one particular program on Linux, Windows, and OSX and Windows alone had all these circular depndencies and just looked like a big mass of spaghetti even in block-diagram form... with low-level libraries calling into top-level libs, some libraries bypassing a layer or two for some calls while not bypassing them for others, and so on. Up through XP, code in Windows just kind of accreted (it was based on Windows NT3.5/4/2000, but had shell code and a bunch of other stuff added in from the 1/2/3/3.1/95/98 branch (ME shall not be named)). I think some people at Microsoft realized this was completely untenable in the long term, Vista/7/8 have pulled whole subsystems out (and hopefully cleaned up some of the rest.)
As for the actual topic.... well, I've got no complaint about Microsoft doing this. I haven't looked at the language to judge it's merits.
"Silverlight is still gaining ground for video-streaming. Netflix uses it (a pretty damn massive user) and Blinkbox switched TO it only a month or two back."
Didn't Steven Sinofsky and Dan Hachamovitch announce last year that Windows 8 was going 'plugin-less' for the Metro browser ?
[SS]
This post is about a big change in Metro style IE, which is the plug-in free experience. In Windows 8, IE 10 is available as a Metro style app and as a desktop app. The desktop app continues to fully support all plug-ins and extensions.
[DH]
For the web to move forward and for consumers to get the most out of touch-first browsing, the Metro style browser in Windows 8 is as HTML5-only as possible, and plug-in free. The experience that plug-ins provide today is not a good match with Metro style browsing and the modern HTML5 web.
That info might be out-of-date but If that's not changed, and considering the market share trends for desktop vs. mobile/tablet usage, isn't basing something on Silverlight (or Flash or similar) rather limiting usage or adding to development times and costs ?
a little from Column A, a little from Column B.
I don't think that's changed but IE10Metro is not the only browser. Even on a WinRT tablet, there's still IE10 Desktop which can handle plugins (and does - flash, for example).
So yeah, I agree that Silverlight is only a short-term solution but it does work, for now.
I've been hoping that TypeScript is received well encourage MS to make another translation utility - one that rewrites WPF to HTML5 wouldsolve their Silverlight problem and make my life a bit easier at the same time.
"which is made mostly redundant by HTML5."
Well it would be if HTML5 spec actually supported DRM or streaming. There is a W3C draft for streaming, but it's a mess. MS's open standard alternative that they submitted a month or so back is better. Still the DRM issue, though.
Damn right. It's time they simply agree to support a new language natively in browsers rather than keep flogging ways to make using JS a bit less crap. The ECMA version in AS3 is pretty nice.
I'd love it if C# was chosen (the core functionality anyway) but I cannot see that happening.
When I was young and carefree I thought it'd be great if everyone used the same OS to ensure cross platform compatibility. Even at that tender age with experience of Sinclair Spectrums and CP/M I could see that it would need a hardware abstraction layer to cater for different hardware and an easily replaceable front-end to cater for different users. But clear one OS across the board would be great for users and business.
Then I discovered that MSDOS allowed you to change the front-end and use any command interpreter and I was pleased.
A few years later I found that Windows NT used something called HAL and I was nearly overjoyed.
I'm now old(er) and jaded. I wonder why :-/
> it would need a hardware abstraction layer to cater for different hardware and an easily replaceable front-end to cater for different users.
All CP/M systems consisted of 3 parts: The BDOS, the core operating system that was the same in all systems (for a particular version), the BIOS which contained the hardware abstraction layer, and the CCP (Console Command Processor), which could be replaced by any other front-end.
> Then I discovered that MSDOS
SCP-DOS, later called MS-DOS, was a clone of CP/M for 8086/8088 and kept the exact same structure, including the ability to replace the CCP (called command.com). It happend that on IBM PCs there was a BIOS in ROM so the MS-DOS BIOS on those machines could be quite small, while on, say, S100 based systems it was very much like a CP/M BIOS.
Having used numerous strongly typed OO languages, JavaScript just feels like a noddy language. I agree it's being used for way more than was ever intended. Perhaps it is time to improve it. I'm sure you can still write rubbish code if required.
It would seem from the video you can use strong types only, or add in classes and interfaces as required. I think this could be a great thing so long as the JavaScript that is produced is not too inefficient compared to hand-coded JavaScript. The fact that it can still talk to jQuery and all the existing JS libraries means it's easy to give it a try without having to start from coding everything from scratch.
We saw this unveiled by Shanku Niyogi at MS office in Edinburgh last night, and I was quite impressed.
Admittedly I've never attempted to use CoffeeScript yet, but as someone who deals with a fairly large JS infrastructure every day, I can see the advantage of developing in an environment with pseudo-strong-typing and class/module support. I will of course be looking into the competition, but from an initial glance it looks like CoffeeScript is just syntactic sugar, rather than IDE-style type checking and warnings?
Obviously object orientation isn't suitable for every project, but using TypeScript I would be able to use it or not use it, and the compiler just wouldn't say a thing. There's an online compiler using Microsoft's new code-editor-for-the-web at http://typescriptlang.org.
What sucks about CoffeeScript is that it's not Javascript. Oh, it compiles to Javascript but if you wanted to extend a small project into a large project from a base of existing js, that js isn't CoffeeScript and won't compile.
TypeScript is Javascript so you can paste your js into your TypeScript environment and work away. And what comes out will be "pure" standard Javascript. I know this because I tried it last night.
I haven't fooled around with Dart because... well, mostly because I haven't got round to it so I can't comment on that. However, the assembled commentards will happily pass judgement on things they have utterly no idea about for you, should you require it.
On the face of it, this sounds great (though I obviously have to look at it in detail).
Static Typing (though I assume var is still supported for interop) is exactly what we need for well-engineered clientside functionality
Proper inheritance will make things much easier to structure
Generics support would be fannytastic
This is pretty exciting! It's like C#, for the browser.
Agreed. However what it doesn't do is actually guarantee that you're using types correctly. You still use var to declare variables, but you can then specify a type using additional syntax. I don't know whether the compiler can be made to reject code which misuses variables (for example placing an integer in alert() causes an error - the function is meant to accept a string), or whether it's more intended to display warnings, but I do know that the playground online just compiles the code anyway, regardless of misused variables.
Hopefully at some point they'll set up the ability to save your own examples on the playground, a la jsfiddle, which would make it easier to explain these things!
I'm right behind you on the shameful lack of security in current implementations of the JVM. To do that to a virtual ISA that was invented specifically to be provably safe and correct strikes me as a particularly cruel slap in the face to its original designers. However...
...I'm old enough to remember when Javascript was *habitually* disabled by anyone with a clue because every implementation was shot full of holes. There's no reason why the effort now being invested in either C# or this rather silly Javascript-front-end couldn't have been put into engineering a JVM that was actually safe for client-side use. Then you'd have a shiny new statically-typed, object oriented language with several billion existing lines of code and squillions of programmers who knew how to use it.
But no. Apparently we have to invent our *own* wheels. Even in the unlikely event that Microsoft have "round" in mind, this is still the wrong answer.
MS have supported JavaScript for a long time now. They've never been a Java house. I don't know whether the reasons behind that are ideological (Hejlsberg is know to admire the concept of Java but hate the language implementation), commercial (why choose MS Java over IBM or Oracle?) or plain ol' NIH but that's the way it's been for a long time.
I do disagree with you about inventing wheels. They haven't. They've built a wheel-making tool, which is a different proposition. This isn't a new browser language - it's merely a more straightforward way of producing JavaScript.
What's nice about it - the USP if you will - is that it takes your existing JavaScript without alteration so it's actually rather more standards-compliant that CoffeeScript.
You need to look at the history, then. MS implemented the JVM on Windows (not Sun) until they fell out with Sun, at which point Sun started offering their JVM on Windows. The falling out was over incompatibilities between Microsoft's JVM and Sun's. Any such incompatibilities would, of course, reduce Java's "write-once, run-anywhere" property, so incompatibilities were a bad thing if you were Sun and a good thing if you were Microsoft.
It was, of course, pure co-incidence that Microsoft's own VM-based, garbage-collected, object-oriented language with C/C++ syntax happened to be released so soon after the big bust-up with Sun over Java. Oh hang on, no it wasn't, it was a direct consequence of MS hiring Hejlsberg to create a replacement.
Perl manages just fine and dandy without static typing.
JavaScript's mistake was trying to use the same operator for two different operations on two different (but not-always-distinguible) scalar-ish types. As a result, you can't reliably add numbers in JavaScript, because the + operator concatenates anything with a string-ish manifestation.
Unfortunately, I don't know of a way to fix this and not break every bit of JavaScript ever written.
I think not.
The comment that this is to match Google with their net-language-de-jour seems plausible.
And please remember *any* language/utility/IDE/whatever looks good in a product demo *because* it's a product demo developed (if not being carried out) by *experts* in the product..
It's flaws (and I *guarantee* there will be flaws) will take longer to find.
MS will hope long enough to hook enough developers that it has critical mass and they (or their managers) won't want to admit they jumped in eyes wide shut.
Obviously the cynic in me doesn't automatically trust someone from MS tell me that they're supporting standards, but I *did* get the impression that they wanted to help rather than hinder. The direction they're taking has reportedly been chosen to try and keep them in alignment with ES5 and the upcoming ES6, vis their participation in the standards group. Additionally, none of the feature they're adding actually form part of the language. Because it compiles out to produce pure JS at the end, it means they can develop along whatever lines the language takes. If, somewhere down the line, ES introduce "proper" OO, or some sort of static typing (not that it's likely, or desirable), the TS compiler can just output those from the proprietary syntax they already have. There's nothing there that prevents the feature form being used in JS. In theory at least!
But putting the language features outside the browser in the pre-compile area will mean they will probably stay there. If these features do not make it into JS then its just another case of EEE and until they do there is still the separation problem where you are debugging machine code having written a higher level code. This really does make life very difficult.
It is technically no better than coffeescript or any of the hundred of other JS 'compilers' put there and I am not looking forward to have to try and maintain huge chunks of undocumented code spewed out by them.
You may have got the impression they want to help but they happily threw away millions of lines of silverlight code rather than opening it up and now this???
"TypeScript is free, open source and compiles into garden-variety JavaScript that Microsoft has taken pains to state repeatedly will run on any browser, host or operating system". Surly they meant "will run on any Microsoft browser, host or operating system" instead, didn't they?
This post has been deleted by its author
Both emacs and vim exist for Windows, so this proves nothing. In order to compile ts code one presumably needs a tsc (ts compiler). Get your popcorn and watch:
$ git clone https://git01.codeplex.com/typescript
$ cd typescript
$ make
Makefile:123: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
Not very diplomatic of Microsoft to wrap it in their proprietary format if they want the web developer community to look at what they have to offer.
Javascript has lots of problems but why didn't MS make the suggestions to the JS working group? As it is they have suggested something that, like Dart, requires an additional runtime in the browser or, like CoffeeScript, a pre-compile to JS.
"Javascript has lots of problems but why didn't MS make the suggestions to the JS working group? As it is they have suggested something that, like Dart, requires an additional runtime in the browser or, like CoffeeScript, a pre-compile to JS."
You've misunderstood how this works. This isn't like Dart, and it's not really like CoffeeScript which is "syntactic sugar". This actually compiles to Javascript. There's no reason to seek suggestions from the JS working group because this doesn't change anything in Javascript. It happens above that layer with standard Javascript coming out the other end.
You've misunderstood how this works.
Possibly because, as I said, MS have made a video which I can't watch.
This actually compiles to Javascript
In this respect it is like CoffeeScript: you can't just ship it to the browser. Though I assume we can expect to release a version of IE that does support TypeScript and benefits from the kind of compiler optimisations that LLVM can't provide.
There's no reason to seek suggestions from the JS working group because this doesn't change anything in Javascript.
I was suggesting the other way round: JS is being actively developed and, therefore, open to suggestions.
It looks like Microsoft has come up with another niche language for its developer eco-system.
"Possibly because, as I said, MS have made a video which I can't watch."
It's also explained in the article and on the linked site, though yes, it would be nice if they hadn't used Silverlight. (Though I'm curious what platform you're on that can't view Silverlight if you want to. It's available for Macs and Moonlight makes it available on Linux, I think).
"In this respect it is like CoffeeScript: you can't just ship it to the browser. Though I assume we can expect to release a version of IE that does support TypeScript and benefits from the kind of compiler optimisations that LLVM can't provide"
Why do you assume that? Remeber that for compatability across browsers, you will only be shipping the Javascript normally, so IE wont have access to the TypeScript source anyway. Though anything IE does in terms of optimizing, other browser makers can equally do. There's nothing to stop Opera or Chrome or Firefox from having optimizations for compiled TypeScript. Nor even writing a parser for TalkScript directly if they wanted to.
"I was suggesting the other way round: JS is being actively developed and, therefore, open to suggestions"
I think that MS do make suggestions and contributions to the JS Working group. They're an active member if I recall correctly. But adding strong typing, class inheritance and futher features onto Javascript is a lot more than a suggestion. It's requesting a re-write of the language into something else. And that would be a real pain for Browser writers everywhere. This way, you have instant compatability with all browsers and past browsers too.
"It looks like Microsoft has come up with another niche language for its developer eco-system"
If you re-evaluate this in light of what I've written above, I think you'll see that this is actually a powerful tool for producing Javascript-based web-applications. It's fully compatible with all current browsers and more far powerful that CoffeeScript, so why should it be niche?
OK, he says it isn't type provable (it can't be because it allows 'any' types) but there's a lot of really nice ML-like type inference going on here.
As someone whose main gripe with JS is lack of types leading to runtime failure I think this could be a real boon - but I'd want it the same code completion & inference tricks in Eclipse, please!
It is interesting that MS have chosen to bring this new JS wrapper out at this poiont, considering that Flash is now doomed (Thank you Jobs) to become moribund and HTML5/CSS needs something like JS to make it a complete development solution. I expect there will be many Flash AS3 developers who will crave the great leap forward that Adobe acheived when moving fro AS2 to AS3 when they look at the scarily untyped and unsctructured language of JS. What MS have done is provide a comforting path from AS to JS via this new TypeScript IDE and once that gains traction among web-developers it will become the de-facto standard for large scale Web and App development that used to belong to Flash (or even Silverlight).
True, MS may be just blowing smoke over their desire to maintain standards but at the moment they seem to be the best game in town and I am definitely going to be jumping on-board this train.
I was very impressed by the video. It would be very helpful on a project I'm working on at the moment.
It seems to produce acceptable JavaScript, and I was surprised at the open source license.
However, when you think a little deeper you realise that it is almost exclusively useful for it's code-completion and error-checking which only really appears to be that active in Visual Studio.
I'm not despoiling my fast, simple and beautiful machines with such an intrusive and bloated stack.
With an appropriate toolkit, and an editor with parenthesis matching and code-folding it is no harder to write good, object-orientated JavaScript than with a full-featured IDE; especially for large applications.
It is not a bad thing to make sure your design and implementation strategy are already correct before you start typing...
VJET is an open source add-in to Eclipse created by eBay which provides typing for JavaScript but in a more elegant way (IMO). It's more elegant because the JavaScript is not changed so there's *no compile step required*. It does all this stuff but without the need to hack the javascript code that will execute. Here's a function declaration:
// > public int power(int num, int exp)
var power = function(num,exp) { return Math.pow(pow,exp); };
Object literals can be declared and typed:
var ol = {
// > int
prop1: 0,
// > string
prop2: "a string",
/**
* This comment will be shown in code completion
*/
// > void fn(mylib.mytype arg1)
prop3: function(arg) { ... }
}
An author of a JavaScript library can provide a type library (packages of types) and VJET comes with libraries for common JavaScript packages like JQuery.
http://www.ebayopensource.org/vjet
And quite liked it.
One example.
Three.js camera has a property called 'rotation' well blame me but I assumed it was a Matrix.
Off course running the script showed me it was supposed to be 3 angles stuffed in a vector.
So what I did was create a declaration for camera and matrix and I won't make wrong assumptions anymore.
If three.js was a decent C++ or JAVA or whatever library I wouldn't have encountered this issue.
What about Dart you say? I'll use it when it replaces JS.
What about Coffeescript? This is good but it has way different syntax and the tooling story isn't that great. Refactor.Rename in Coffeescript?
just saying. I find this 'language' useful because I like static types with some dynamic options when needed.