Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

TypeScript: Microsoft's Replacement For JavaScript

samzenpus posted about 2 years ago | from the no-code-on-the-block dept.

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

cancel ×

488 comments

Sorry! There are no comments related to the filter you selected.

Remember the old addage (-1, Flamebait)

Anonymous Coward | about 2 years ago | (#41518537)

Embrace, Extend, Extinguish.

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

Re:Remember the old addage (0, Troll)

gweihir (88907) | about 2 years ago | (#41518747)

Indeed. Pull people in, but let nobody out. Drink this poison at your own peril.

Re:Remember the old addage (5, Insightful)

MHolmesIV (253236) | about 2 years ago | (#41518871)

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

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

Re:Remember the old addage (2)

exomondo (1725132) | about 2 years ago | (#41519251)

Agree, I can't see how anyone is any more 'locked in' to this than they would be if they used say Google Dart.

Re:Remember the old addage (4, Insightful)

SplashMyBandit (1543257) | about 2 years ago | (#41519289)

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

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

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

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

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

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

Re:Remember the old addage (4, Informative)

exomondo (1725132) | about 2 years ago | (#41519305)

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 (1)

SplashMyBandit (1543257) | about 2 years ago | (#41519313)

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++/

... and the other howlers (too lazy [and at too busy at work]) to fix those. Apologies.

Re:Remember the old addage (1)

Deathlizard (115856) | about 2 years ago | (#41518959)

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:Remember the old addage (2)

narcc (412956) | about 2 years ago | (#41519363)

Just keep calling it "ECMA Script" until it sticks.

Good luck.

Re:Remember the old addage (5, Insightful)

Anonymous Coward | about 2 years ago | (#41519127)

Embrace, Extend, Extinguish.

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

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

Re:Remember the old addage (2)

aztracker1 (702135) | about 2 years ago | (#41519275)

Beyond that, a lot of it seems to line up with the EcmaScript6 work in progress spec, and Anders seems to be interested in re-aligning to that spec as it moves forward. What I found really interesting above everything else, is that it's an npm (node.js) module, and runs from node.js, not WSH, or some other bastardized environment. As I am working on publishing a JSON web service currently, I already have my object definitions documented in a JSON structure very similar, and may just adjust them all to *.d.ts, since it's fairly obvious the intent. I'm still testing using the newer WebAPI from MS, or simply going Node.js for the API service itself... leaning towards node + mongo... but the option seems fairly clean, and open.

I just hope it doesn't wind up another also ran.. It would also be nice to get .d.ts files out of coffee-script declarations for classes as well, so that it can be more interoperable. It would also be nice to see other IDEs adopt the idea. I think JS interaction, and intent of code (documentation, and interaction) is the most difficult thing, which this works to resolve... Though it does remind me a lot of ES4/AS3.

Embrace, Extend, Extinguish (1, Insightful)

turgid (580780) | about 2 years ago | (#41518539)

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!

And this suprises you? (-1)

Anonymous Coward | about 2 years ago | (#41518737)

This is modus operandi for Microsoft, they were convicted for a reason.

Just remember, its either Open or it isn't, no half way house.

Nearly pregnant, nearly dead, nearly open, the Apache license.

Not to mention FRAND.

Once upon a time Slashdot used to stand for something.

Re:And this suprises you? (2, Insightful)

MHolmesIV (253236) | about 2 years ago | (#41518907)

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

Re:And this suprises you? (1)

Microlith (54737) | about 2 years ago | (#41519361)

the Apache License is significantly more free than the GPL.

For varying perspectives on what constitutes "free."

Re:And this suprises you? (1)

spongman (182339) | about 2 years ago | (#41518967)

nearly sane.

Full classes? (0, Troll)

Anonymous Coward | about 2 years ago | (#41518555)

Doesn't JavaScript have a better system altogether? Prototypical inheritance?
Classes feel awful in comparison.

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.

Regardless, any and every attempt to expand on things is always good.
Yes, even if it is Microsoft. They gave you the website you are using now, remember. (unless you are in the 80s using some text browser)
Competition will hopefully lead to quicker implementations of a much better language overall.

Re:Full classes? (0)

Anonymous Coward | about 2 years ago | (#41518897)

I'm not even gonna go into the server-side JavaScript.

It sure is. Many have come and many have faded in efforts to outdo/replace JavaScript. The single most impact is by Chrome V8, because it improved the performance of the JavaScript engine and NOT change JavaScript the language.
UI, esp. good Web UI, is very hard. It's not for pussies and JavaScript is not to blame.

Re:Full classes? (3, Informative)

chromatic (9471) | about 2 years ago | (#41519009)

v8 (and other optimized JavaScript implementations) have decent performance despite JavaScript the language.

Re:Full classes? (1)

spongman (182339) | about 2 years ago | (#41518985)

if prototypical inheritance is so great, why does almost everyone write a class-like wrapper around it to make it useful?

Re:Full classes? (1)

MightyYar (622222) | about 2 years ago | (#41519201)

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]

if (typeof Object.create !== 'function') {
    Object.create = function (o) {
        function F() {}
        F.prototype = o;
        return new F();
    };
}
newObject = Object.create(oldObject);

Re:Full classes? (1)

spongman (182339) | about 2 years ago | (#41519353)

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:Full classes? (1)

mrbester (200927) | about 2 years ago | (#41519391)

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:Full classes? (2)

aztracker1 (702135) | about 2 years ago | (#41519301)

Because they don't understand how prototype based inheritance chains work, or how to utilize functional programming techniques. When you add event driven callbacks, along with non-class based structures in JS, it can be very elegant, and with Node.js + async, far more performant than other solutions..

Re:Full classes? (0)

Anonymous Coward | about 2 years ago | (#41519333)

Because most people fail to drag their puny minds away from torturous years of C and C++ and the many mistakes they have brought.

Where are classes in Lisp?

btw, I challenge your assumption: jQuery doesn't have any class-like wrappers (jQuery UI sorta does, but that isn't the point of the jquery UI widget object). I am unaware of any in underscore either. Or Backbone, or Socket.io (or most other node libraries) or Ace or anywhere in Firefox ...

DEFINITELY No!!! (-1, Flamebait)

luckymae (2691983) | about 2 years ago | (#41518559)

This is another example of Microsoft trying to pollute open standard! Yes, I am aware that it's under Apache 2.0 License, but they're just going to introduce chaos and evil as usual like their Sharepoint piece of $h1t. DEFINITELY NO NO NO NO NO !!! NO NO NO NO NO !!! NO NO NO NO NO !!! NO NO NO NO NO !!! NO NO NO NO NO !!!

Re:DEFINITELY No!!! (-1)

Anonymous Coward | about 2 years ago | (#41518637)

Yup... just wait until they start adding in one or two absolutely necessary features, patent the shit out of it, and then sue the hell out of everyone who tries to implement it...

Re:DEFINITELY No!!! (2, Insightful)

Anonymous Coward | about 2 years ago | (#41518697)

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

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

Re:DEFINITELY No!!! (2)

luckymae (2691983) | about 2 years ago | (#41519019)

But it's not coming from Microsoft. Look at the incompatibilities introduced by their past technologies: C# (copycat from Java) and simply calling it C#, MS Internet Explorer (the worst), Web Form (.NET 2.0), etc, Active Directory (vs LDAP). These are nothing but fads.

Re:DEFINITELY No!!! (2)

santax (1541065) | about 2 years ago | (#41519093)

Actually C# is a great platform for RAD. Just because it's MS doesn't mean it is always shitty or evil. It isn't on the 5th place of most used languages because it sucks.... Lots of pro's are using it and many a serious C++ picks C# for fast prototyping and development. It's all about knowing what tool to use for what task. http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html [tiobe.com]

Re:DEFINITELY No!!! (4, Insightful)

SplashMyBandit (1543257) | about 2 years ago | (#41519385)

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

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

Re:DEFINITELY No!!! (1)

exomondo (1725132) | about 2 years ago | (#41519231)

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 post that makes sense.

Re:DEFINITELY No!!! (1)

binarylarry (1338699) | about 2 years ago | (#41519379)

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.

What are google's two js replacements? (4, Interesting)

Bill, Shooter of Bul (629286) | about 2 years ago | (#41518565)

Dart, obviously. But what is the other one? Anyone know what the article writer was talking about?

Re:What are google's two js replacements? (1)

Anonymous Coward | about 2 years ago | (#41518617)

GWT?

Re:What are google's two js replacements? (1)

Bill, Shooter of Bul (629286) | about 2 years ago | (#41518657)

I don't think that qualifies as a language, but maybe that's what the author meant.

Re:What are google's two js replacements? (0)

Anonymous Coward | about 2 years ago | (#41518825)

Go, maybe? Or was that more intended as more complex than a web client language?

Re:What are google's two js replacements? (1)

Lennie (16154) | about 2 years ago | (#41518903)

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:What are google's two js replacements? (2, Informative)

Alternate Interior (725192) | about 2 years ago | (#41518845)

Clojure: http://clojure.org/ [clojure.org]

Don't think it's formally Google anymore.

Re:What are google's two js replacements? (1)

lahvak (69490) | about 2 years ago | (#41519089)

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:What are google's two js replacements? (0)

Alternate Interior (725192) | about 2 years ago | (#41519157)

Just a different way of thinking. Purely functional programming is possible in JavaScript, and is basically mandated in Clojure. So it's more like comparing JavaScript and "use strict"; -- you want to be pure in your algorithms and so it babysits you.

Re:What are google's two js replacements? (1)

Anonymous Coward | about 2 years ago | (#41519271)

More specifically, you want to look at ClojureScript (https://github.com/clojure/clojurescript), which compiles clojure to javascript.

Re:What are google's two js replacements? (1)

Shados (741919) | about 2 years ago | (#41518931)

Id say GWT if i had to guess.

Re:What are google's two js replacements? (1)

mrmtampa (231295) | about 2 years ago | (#41519267)

Dart, obviously. But what is the other one? Anyone know what the article writer was talking about?

CoffeeScript is probably the second.

I am still busy with silverlight (5, Funny)

superflit (1193931) | about 2 years ago | (#41518599)

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

Oooppss. that did not work....

Re:I am still busy with silverlight (1)

NinjaTekNeeks (817385) | about 2 years ago | (#41519149)

Don't lie, no one uses Silverlight.

Re:I am still busy with silverlight (1)

jason777 (557591) | about 2 years ago | (#41519253)

I use it. Just released a game written in it: http://aggravation.codeplex.com/ [codeplex.com]

CoffeeScript, Dart and this - screw it all (5, Insightful)

thetoadwarrior (1268702) | about 2 years ago | (#41518613)

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

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

Re:CoffeeScript, Dart and this - screw it all (3, Interesting)

neminem (561346) | about 2 years ago | (#41518687)

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:CoffeeScript, Dart and this - screw it all (1)

cc1984_ (1096355) | about 2 years ago | (#41518711)

You know you could always post as an AC

Re:CoffeeScript, Dart and this - screw it all (0)

Anonymous Coward | about 2 years ago | (#41518779)

He's playing for modesty mod points.

Re:CoffeeScript, Dart and this - screw it all (1)

neminem (561346) | about 2 years ago | (#41518817)

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 (0)

Anonymous Coward | about 2 years ago | (#41519165)

you sound like a rambling schizo. also xkcd sucks.

Re:CoffeeScript, Dart and this - screw it all (5, Funny)

neminem (561346) | about 2 years ago | (#41519209)

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

Also, your mom.

Do you have a karma allergy? (5, Funny)

Qubit (100461) | about 2 years ago | (#41518873)

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

Note: please do not mod this post up.

Note: please do mod this post up

Re:CoffeeScript, Dart and this - screw it all (3, Insightful)

Anonymous Coward | about 2 years ago | (#41518703)

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

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

Re:CoffeeScript, Dart and this - screw it all (2)

thetoadwarrior (1268702) | about 2 years ago | (#41519057)

It gets even better.

"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 (3, Informative)

aztracker1 (702135) | about 2 years ago | (#41519365)

Maybe because JS engines are more powerful these days than PHP? Maybe because the language primitives, and base functionality is far more consistent (not talking browser DOM)? Personally, I've been using Node.js for more and more, simply because it does the job so well, and leverages a language, that any currently working developer should probably have knowledge of.

Re:CoffeeScript, Dart and this - screw it all (0)

Anonymous Coward | about 2 years ago | (#41518719)

Uh, what's so bad about Javascript? I've never had any trouble with it other than browser incompatibilities, but that's not the language's fault.

Re:CoffeeScript, Dart and this - screw it all (1)

thetoadwarrior (1268702) | about 2 years ago | (#41518971)

I actually agree. Plain old JS itself is better than using a million libraries. That said, I will admit having to write your some dom abilities like getting elements by class name, while easy, should be baked into a web language and the incompatibilities should be done away with. Making an ajax call should be the same across all browsers. I would also like to see them tighten up the rules so it's clear to the JS hipsters to use it as it was intended instead allowing them to write JS that manages to work but it just waiting to break down the line anyway.

Re:CoffeeScript, Dart and this - screw it all (1)

aztracker1 (702135) | about 2 years ago | (#41519393)

Well... there are several libraries that do a really good job at abstracting DOM implementation differences and Ajax variances. From jQuery, Dojo, YUI, MooTools, Prototype, and the list goes on. The language is pretty straight forward, but documentation, and declaration of intent are the hardest parts in maintaining a larger project... this helps with a lot of that, while not forcing it on you.

Re:CoffeeScript, Dart and this - screw it all (2)

narcc (412956) | about 2 years ago | (#41519297)

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 simple things that could have been handled with CSS. The worst abuse I've see was the inclusion of jQuery to do nothing more than redirect the user to another page when they clicked a button. Seriously. )

If you stick to a simple subset of the language, know how to write modular code, and avoid ridiculous libraries like jQuery, javascript can be a very nice language.

Re:CoffeeScript, Dart and this - screw it all (0)

Anonymous Coward | about 2 years ago | (#41518731)

All real and good languages compile to some freaking weird assembler in the end. Doesn't make the languages bad. Microsoft is going in the right direction here. Think of actual JavaScript as assembler and just ignore it.

Re:CoffeeScript, Dart and this - screw it all (1)

thetoadwarrior (1268702) | about 2 years ago | (#41519003)

Why not code that compiles to PHP while we're at it. Just because it can be done doesn't mean it should be.

Re:CoffeeScript, Dart and this - screw it all (1)

aztracker1 (702135) | about 2 years ago | (#41519407)

Because JavaScript is the single most widely available run-time environment in the world, and even has a server-side environments available for pretty much every platform with more than 10K systems running... JS delivered where Java failed.. that's why.

Re:CoffeeScript, Dart and this - screw it all (-1)

Anonymous Coward | about 2 years ago | (#41518757)

What's the problem with a dozen implementations? In true open source mentality it is the typical expression of software Freedom (as in libre, as in fragmentation)!

Yes, sarcasm

Re:CoffeeScript, Dart and this - screw it all (0)

Anonymous Coward | about 2 years ago | (#41518761)

Microsoft or die!

Works for me! When shit like this happens!

Dictators can be good!

Re:CoffeeScript, Dart and this - screw it all (0)

Anonymous Coward | about 2 years ago | (#41518767)

The browser at this point in time should come with a VM, along the lines of .Net's CLR, or javas VM, and web apps should be distributed in bytecode that runs in a safe sandbox. And people use whatever language they want.

It will never happen though, to see why just look at the comments in this thread.

The web world is to polluted with asshats with no actual technical knowledge, so they make their decisions based on childish groupthink about who's the supposed 'bad guy'. The open source community isn't capable of any big leaps forward, so we're stuck with corporate contributions. Which will always be soundly rejected based on ARRRRR XBOX IS DUMB FUCK MICROSOFT M I RITE

Re:CoffeeScript, Dart and this - screw it all (1)

thetoadwarrior (1268702) | about 2 years ago | (#41519095)

That would be an excellent idea but no one will agree on it. It's not just the users though. I don't think you'll get Microsoft or Google to agree on something. TypeScript in a way is basically Microsoft telling Google where to stick Dart.

Re:CoffeeScript, Dart and this - screw it all (1)

binarylarry (1338699) | about 2 years ago | (#41519159)

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!

Re:CoffeeScript, Dart and this - screw it all (4, Insightful)

Anonymous Coward | about 2 years ago | (#41518963)

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

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

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

Some desirable properties would be:

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

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

Re:CoffeeScript, Dart and this - screw it all (1)

aztracker1 (702135) | about 2 years ago | (#41519343)

Well, CoffeeScript seems to be the prescription you are looking for... I don't think Dart will take hold so much... this seems a lot like the EcmaScript4/ActionScript3 direction taken as a pre-processor for JS, with some decent UI hinting to go with it... I do like that the *.d.ts files are pretty self documenting, and could be useful in defining object models for use with JSON based web services... the documentation I've been creating is very similar, as it's pretty straight forward, but may actually refactor to a .d.ts file... the specific implementation details are still under way though.

I think this is far more of an extension to JS, than even CoffeeScript, which does a lot of similar things, but changes the language abstraction a lot more.

I like the not so subtle FUD... (2, Informative)

RightSaidFred99 (874576) | about 2 years ago | (#41518621)

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.

Bunch of a**holes can't handle JavaScript (0, Informative)

Anonymous Coward | about 2 years ago | (#41518625)

Stop trying to make JavaScript look like your favorite object-oriented language and accept it as is. It's a fantastic, flexible, un-bloated language that requires a different mind-set to master. Improve your JavaScript Engine performance and your DOM implementation, but leave the language alone. There is a reason why it's kicking so much ass. If you want strong, static typed and OO, go support ActionScript.

Aside from Microsoft's history.... (4, Interesting)

catbutt (469582) | about 2 years ago | (#41518745)

...theirs seems like the right approach. It is certainly a better one than Dart. They've gone out of their way to be as compatible as possible, and really are making it practical for people to adopt the upcoming standards earlier. I really don't see what about this to get so up in arms about. Javascript does need improvements, and this is the best approach to that I've seen so far.

Re:Aside from Microsoft's history.... (-1)

Anonymous Coward | about 2 years ago | (#41518939)

Really? It'll only work in IEx, right? It'll be worth paying attention to if MS makes the toolchain for supporting it available for not-Microsoft.

Anders seems to know his shit when it comes to architecting a language, so no problem with that.

But MS will add a few bits of crap here, leave out a few bits of other crap there, and make still other bits apply to bits and pieces in Windows and say, "well, it 'degrades gracefully to JavaScript', see?", etc.

Re:Aside from Microsoft's history.... (1, Informative)

Anonymous Coward | about 2 years ago | (#41518977)

It compiles to javascript moron. this doesn't replace javascript, it provides a better development interface to it.

Re:Aside from Microsoft's history.... (3, Informative)

MHolmesIV (253236) | about 2 years ago | (#41518951)

Exactly, it's basically a preprocessor for javascript that allows your IDE to help you write better code.

JavaScript is untouchable (1)

Sla$hPot (1189603) | about 2 years ago | (#41518821)

Please go ahead and try to change JavaScript into something new.
But realize that JavaScript is the internet programming language equivalent to Cobol.
It will survive everything you throw at it.
It will be here when you cant chew butter any more.
Yes you can make better compilers, perhaps support for hardware acceleration.
But its too late for making any fundamental changes to the language it self.

0 day exploit found in TypeScript (5, Funny)

logicassasin (318009) | about 2 years ago | (#41518867)

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

Oh FFS (1)

ilsaloving (1534307) | about 2 years ago | (#41518877)

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:Oh FFS (1)

jo_ham (604554) | about 2 years ago | (#41519085)

We already have, what, a couple *hundred* languages to choose from at this point?

Almost as many as we have Linux distros!

Re:Oh FFS (0)

Anonymous Coward | about 2 years ago | (#41519219)

>Don't these people have anything more useful to do?

As if you've ever done anything worthy enough that anyone would care what you think. LOL

Re:Oh FFS (1)

Microlith (54737) | about 2 years ago | (#41519375)

Yeah people! Stop thinking about new ways of doing things! Get in line with the One True Way!

Article title misleading. (2, Informative)

Anonymous Coward | about 2 years ago | (#41518901)

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.

Run, not walk, away from this poison (-1, Troll)

gweihir (88907) | about 2 years ago | (#41518909)

That you can run JavaScript in it does not help. Once you develop with it, some non-JavaScript stuff will creep in and make your programs MS only. I expect it will be impossible to restrict this thing to JavaScript only, as that would defeat its purpose: Attract people and then never, ever let them go again.

Hey M$, (-1)

Anonymous Coward | about 2 years ago | (#41518915)

go fix your damn O$.

From Scheme to ML (1)

Anonymous Coward | about 2 years ago | (#41518947)

So they converted a version of Scheme into a version of ML. Why? Because F#.
Did I get the gist of it?

I'd rather use Script# (1)

_8553454222834292266 (2576047) | about 2 years ago | (#41518955)

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? (1, Insightful)

Nyder (754090) | about 2 years ago | (#41518969)

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? (4, Informative)

Anonymous Coward | about 2 years ago | (#41519199)

c? to write client-side code run by the browser?

are you high?

Didn't they do this with JScript? (1)

luke923 (778953) | about 2 years ago | (#41518979)

Considering how JScript turned out, do we want to go down this road again?

Re:Didn't they do this with JScript? (1)

Anonymous Coward | about 2 years ago | (#41519335)

JScript is the name of Microsoft's ECMAScript implementation, to avoid the trademark issues with Sun (Netscape had Sun's permission to call it JavaScript).

He simply did the obvious extension we needed (0)

Anonymous Coward | about 2 years ago | (#41518983)

He's simply doing what the JavaScript developers should have done a long time ago -- add some kind of type-checking to the language.

It's about fucking time somebody did it, although I would have rather preferred that it was done within the JavaScript language itself.

Re:He simply did the obvious extension we needed (1)

Sla$hPot (1189603) | about 2 years ago | (#41519247)

Are you talking about action script?

Still at it, eh? (0)

140Mandak262Jamuna (970587) | about 2 years ago | (#41519113)

What was that thing Microsoft used to do that was called? Something like Embrace, Extend and Extinguish?

A day in the life of JavaScript (1)

elloGov (1217998) | about 2 years ago | (#41519185)

heyJavaScript = (function (whatYouSay) {
  var theFactIs = "You can't touch this! ";
  return function (freeLesson) {
    freeLesson = "I'm your global daddy!";
    setTimeout(function(){
      self.heyJavaScript = null;
      delete self.heyJavaScript;
      alert("So long sucker!");
    }, 0);
    alert(whatYouSay + theFactIs + freeLesson);
  }
})("You talkin to me? ");

heyJavaScript("How about a makeover?");
heyJavaScript("Listen to me man!");

I find this useful, ignore the FUD! (1)

QX-Mat (460729) | about 2 years ago | (#41519347)

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, structure and ease of maintenance requirements of a good API. Being verbose is not a sin in enterprise Javascript.

I have a lot of little helpers like this:

MyCompany.fetchSomething(function (things) { // actually gives you things
});

Plus some event handlers

MyCompany.addEventHandler('scope', function (data) { // handler
});

But by far the largest section of my code is the model fetching stuff - you know the really boring bits where copy by value doesn't cut it, I need functions and and objects.

My last trail by fire was a paginated e-book reader with support for embedded video and audio. That wasn't a lot of fun, but at least the CSS3 spec was helpful and the DOM readable. The Javascript in that project was limited to around 200 lines.

I recently discovered that REST libraries are pretty long winded - after 200 or so lines, Javascript becomes a horrible implementation specific mess of spaghettied anonymous function chains. I opted for the Module pattern and ran into lots of fun:

  1. I have to write all my getters and setters, as properties/getters/setters
  2. Variable lifting/elevating results in seriously ugly var blocks at the top of my functions and causes copy by value in some rather obvious block scopes
  3. Fast enumeration (for x in a) doesn't work
  4. Itterating through ordered keys is painful with associated hashes - you have to create a key enumerator (with pushes! ) each time you want order. jQuery doesn't particularly help.
  5. Everything runs on the same thread.
  6. Post increments don't work in for loops, for (i = 0; i
  7. Prototypical inheritance is pointless key bashing - it pollutes your vision with the use of 'self' everywhere god forbid you miss a one.
  8. Inheritance is a dirty word unless you've already written things in a special way (prototype extension is just a dirty hack!)
  9. Given a lack of compile stage, writing code is error prone and debugging a tiresome line by line experience
  10. Chained async callbacks are inflexible, hard to read and painful to edit. Expanding ajax piped promises to a colleague made him cry and take a week off sick.
  11. Everything has to be a fucking DOM element before jQuery/the DOM will play nice
  12. Preloading code, initializing it and handing off to that code is painful/ugly with self initializing modules.

So with MS actually targeting 5 or more of the annoying problems I face, I find this library really useful. But naturally I'll get modded down because, a) I develop Apple software and b) I don't pick sides, I program (I like Windows 7 as my desktop, XCode as my IDE, and Slackware on my shell - go fish!).

Oh well, I can only dream of this being adopted!

Compatibility be damned (0)

Anonymous Coward | about 2 years ago | (#41519373)

We need a clean-slate approach to clientside embedded scripting. Something with
* strong typing
* CLR-like JIT compilation
* solid documentation
* robust cryptographic facilities with hardware acceleration

With everyone rolling out their half-assed attempts at creating something 'better' that's really just another layer on top of the old, bad JS, it's no wonder we're not getting anywhere.

Science Fiction comes to Life (0)

Anonymous Coward | about 2 years ago | (#41519401)

The Green Brain [wikipedia.org]

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?