Feeds

back to article Microsoft releases JavaScript alternative

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 its …

COMMENTS

This topic is closed for new posts.

Page:

Standards

Not too long ago I sat through a presentation from Microsoft that was extremely repentant of Internet Explorer's wayward past and evangelised IE10's new HTML5/CSS3 credentials. Seems that was a short-lived sentiment.

4
4
Silver badge
WTF?

Re: Standards

How is an environment which produces standard javascript an indication that MS are no longer repentant about buggering standards?

6
1
Anonymous Coward

Re: Standards

confused.

What's this got to do with IE?

1
0
JDX
Gold badge

Re: Standards

It's almost like he didn't read the article.

3
0
Thumb Up

Actually...

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.

5
0

Re: Actually...

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!

0
0
Gold badge

Re: Actually...

"It's like C#, for the browser."

Excuse me? Some of us are old enough to remember when C# was a shameless rip-off of Java and the only reason for its existence was that MS had fallen out with Sun. It sounds like the 1990s are coming around for another go.

3
5
Bronze badge
Mushroom

Re: Actually...

But faster, more powerful and much much more secure...how many hundreds of JVM vulnerabilities so far??

2
3
Silver badge
Terminator

Even Toasters know better!

much much more secure

"All of this has happened before, and all of this will happen again."

0
0
Silver badge

Perl manages without static typing

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.

0
0
Gold badge

@RICHTO

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.

2
0
Silver badge

@Ken Hagan

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.

3
0
Gold badge

Re: "MS have [...] never been a Java house."

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.

1
0
Silver badge

Re: "MS have [...] never been a Java house."

Good point. Nevertheless, they support Javascript but no Java so the point stands.

And frankly, having used both Java and C#, I'd rather write COBOL than go back to Java.

2
0
Anonymous Coward

obligatory

http://xkcd.com/927/

1
3
Anonymous Coward

Re: obligatory

Irrelevant. No standards were harmed, breached, created or extended in the making of this utility.

Did you not read the article?

3
0
Thumb Down

nice far* addition.. but..

There was a time when Microsoft enhancement were universally welcomed (like far pointers for 8086 && ODBC), but now they need to do more to regain the trust of developers, and that means open-source .NET (not just F#, Micro Framework & ROTOR.. but the full framework).

0
0
Anonymous Coward

Re: nice far* addition.. but..

Have they *lost* the trust of developers?

They maybe lost the trust of the reg commentards (if they ever had it to lose), but I don't think the general reaction to this implies they've a whole lot of regaining to do.

3
0
Bronze badge

Good luck to them

they'll need it with the amount of MS hating and language snobbery out there.

No VS2010 support? Tsk.

3
2
Gold badge
Unhappy

Becase the world *needs* another language.

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.

0
1

free software guidelines

free as in "free beer" + open source != free software

1
0
Vic
Silver badge

Re: free software guidelines

> "free beer" + open source != free software

True, but this is APLv2...

Vic.

1
0
Silver badge

Prevent these features being added to javascript

and then add them to a sold product.

At least I'm assuming that's what's been going on since MS started helping in the standards group.

How much of this was in JS2.0 7 years ago?

0
0

Re: Prevent these features being added to javascript

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!

1
0
Silver badge

Re: Prevent these features being added to javascript

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???

0
0
Joke

any browser, host or operating system

"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?

1
6
Silver badge
FAIL

Re: any browser, host or operating system

No. That's why they made plugins for emacs and vi.

2
1
Bronze badge
Mushroom

Re: any browser, host or operating system

Who on earth still uses those legacy crapollas?. Something from the 1970s that should stay there...

0
8

This post has been deleted by its author

FAIL

That's why they made plugins for emacs and vi.

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.

1
1
Silver badge

Can't watch the video

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.

2
2
Silver badge

Re: Can't watch the video

"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.

0
0
Silver badge
Thumb Down

Re: Can't watch the video

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.

0
0
Silver badge

Re: Can't watch the video

"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?

2
0
Anonymous Coward

Huh?

Wasn't this already invented and called JScript.Net? Why don't developers use that?

0
1
Bronze badge
Mushroom

Re: Huh?

Because JS.Net requires the Microsoft CLR - not available on all platforms / browsers.

1
0
Boffin

Shades of ML

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!

1
0
Bronze badge
Go

Interesting...

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.

1
0
Thumb Up

Alternatives to TypeScript

If Typescript is a "better than" JS style language that converts to JS code, and people are interested in it, then they should also have a look at the HAXE language too, which not only converts to JS, but also converts to other languages like PHP, C++, C#, AS.

2
0

I say go for it.

I mean, all that investment in J++.... oh, um , Silverligh.... oh um.

Well anyway. Go for it. But excuse me if I don't.

3
1
Linux

It looks nice

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...

0
1
JDX
Gold badge

Re: It looks nice

>>I'm not despoiling my fast, simple and beautiful machines with such an intrusive and bloated stack.

It would be terrible to use all those CPU cycles to make your life easier, I agree. What are they thinking, that computers exist to automate tasks or something?

2
1

Use VJET

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

0
0
Anonymous Coward

Irrational MS hatred

There are always haters who say they can't trust MS just because of decades of established behaviour. Why don't you give them a 100th chance to prove they're not trying to run a protection racket this time?

0
1

used it the past few days

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.

1
0

Page:

This topic is closed for new posts.