222 points · by rdtsc · 13y ago · 159 comments
We have a ton of JavaScript/CoffeeScript code and I really wish we could use something like Dart. JavaScript is great for smaller projects, but once you get a ton of code it really becomes a unmanageable mess.
I think tho' it would be amazing if Dart could run on the server side as well. This way you could just have one language on both the client and the server.
Dart not so much since the semantics are different.You can still interact with JS libs but it's not as straight foward as TS.
I tested a number of options (GWT,Haxe,CS,Dart,Opal,Jsx,...),while i'm not a Microsoft fan(by a long shot),Typescript is the solution that allows the best integration with legacy code and pure JS libraries,while making easy to port old java/C#/as3 code to JS.
Dart actually has horrible semantics in places. Only if x === true will if(x) run.
The type-checker will give a very clear warning if it catches you putting a non-bool in a conditional context. And make no mistake: the type checker is an important part of the Dart development process.
(One downside of this is that it does push you to working in the -- Eclipse-derived -- DartEditor, which isn't always a wonderful experience. However, the type checker is exposed and available, and there's nothing to prevent it being tightly integrated into other editors or IDEs.)
[1] And as a practical matter generates faster code, because it can be implemented with a comparison against a single constant.
I think the issue is that JS doesn't have strong conventions for how to do that, so you actually need to make good choices that work well with your app.
I have no doubt that Dart makes that stuff easier, but there's nothing inherent to JavaScript that makes it unsuitable for larger applications. It just forces you to make decisions.
I see it a bit like when Dijkstra wrote "Go To Statement Considered Harmful". I have no doubt a lot of developers at the time objected to it and said "that is wrong, it is possible to write good code using GOTO". Because they probably wrote code using GOTOs and some of that code was probably decent quality.
The problem is that `goto` is easy to abuse, and, worse, easy to abuse inadvertently, e.g. you might produce a `goto` into a loop or something like that during refactoring.
JavaScript is like one big `goto` in this regard.
So if Javascript is "GOTO" then dart is: "function NotGoTo() { GOTO; }"
Dart and TypeScript seem to offer a more familiar path to people who are used to Java/.NET/etc and who have been burned by messy JS codebases.
If you'd like the same language for client and server side, try Kotlin or HaXe.
For now, Dart doesn't have a crossbrowser VM yet (except for Dartium), so it doesn't give you any performance boost over JavaScript. Maybe one day there will be a cross-browser Dart VM as a PNaCl or asm.js module?
[1] http://www.techempower.com/benchmarks/#section=data-r7&hw=i7...
It does but I think Go might be more fitting for that purpose.
Today’s release marks the first time Dart is officially production-ready, and we’re seeing teams like Blossom, Montage, Soundtrap, Mandrill, Google's internal CRM app and Google Elections, already successfully using Dart in production. In addition, companies like Adobe, drone.io, and JetBrains have started to add Dart support to their products.
Congrats to the team on releasing 1. Now to find a project to try it out in...
Once upon a time this was going to be the basis of ECMAScript4 via tamarin, but that never panned out for lots of reasons, most of them political.
ES4 failed mainly because some people thought ES3 was good enough.
Adobe,harshly critized for Flash was the one pushing for a better javascript.
I will never understand why Microsoft basically killed ES4. They had their own implementation on .net ( JScript.net ) so it's not like it was going to be a huge effort. The only reason would be Microsoft pushing Silverlight at that time which was a huge flop. We basically lost a decade because of it, as i predict javascript will eventually look like ES4,that's inevitable.
People without an investment in Javascript have lost over a decade because of Javascript's monopoly on clients being maintained. If we had not been forcibly locked into Javascript all this time, then competition would have produced a better alternative or whipped the process designing Javascript into shape. Now we are stuck with this ridiculously tall, messy stack which uses an application scripting language as a compile target, still lacks basic features like a standard package system, and pushes trivial language features like iteration into third-party libraries like jQuery. So now we are constantly pushing megs of JS, using insanely complicated build systems to get anything done, and for all this trouble our code runs at a speed roughly equivalent to C in 1998.
(Now that Flash and Silverlight are dead I think it is safe for me to complain about Javascript without being an enemy of the open internet or whatever.)
I don't really care about Dart, but it's way past due that there was something serious to challenge Javascript. All the triumphalism about how Javascript is already a perfect language to use for eternity is explicitly counterproductive. Making the whole internet depend on the fortunes of one language just sucks.
Simplicity of the language.
I'll easily agree that ES4 would have been very interesting, but ES5 (and its spiritual successor features in ES6) gave us subtle low-level power that would have lacked otherwise.
Of all of the core libraries in Dart (core, html, io, async, etc.) the isolate library has had the least attention so far. Now that those other libraries are stable, I'm hoping the corelib folks will have the time to give isolates some much needed love.
I definitely want spawnString() too and we've had to do some gross workarounds in pub to deal with its absence (dumping stuff to temp files).
I would expect Google, or at least, a team at Google, to take over NodeJS which is based on their V8 and expand it to universal server client language and libs. JS can be complied into go binaries after all, so why not letting people write apps using the same language.
Let alone I see no effort on their side bringing any of those language into the native world of Android, instead we got this cluttering Java thing as almost the only options for most projects.
Yes, you are, in fact, wrong. Google doesn't have so narrow a vision. Dart is server and client side (the native VM is, aside from a for-testing-only build, server-side only now.) But the client side isn't just Dart (or JS, in which Google has also invested heavily), its also C/C++, and other languages, hence PNaCl, which also just went into general release.
And, sure, Go is a server-side language that Google is putting energy into, but so is Dart. And I doubt their vision ends there, those are just a couple of the more visible active fronts.
> I would expect Google, or at least, a team at Google, to take over NodeJS which is based on their V8 and expand it to universal server client language and libs.
The existing NodeJS team is doing enough for server-side JS-on-V8, and its open source -- Google could throw more resources, but its probably not the best bang-for-their buck in terms of developing new technologies that might improve the options for the things Google is concerned about. Doing what other people aren't doing is a bigger win.
> Let alone I see no effort on their side bringing any of those language into the native world of Android
I've seen quite a bit about Dart on Android (though I think there are issues with building the current distribution.) Less on Go.
Note that that point of view is not universally shared at Google, and many people are fine with JavaScript, and probably would use node.js.
The Dart VM supports ARM, and I've seen prototypes that get it running on Android. The team hasn't had much time to put into it yet, but I wouldn't infer that that says much about what we'll do in the future. (Not that I'm making any promises, either.)
Go is a better C++.
Rust is a better C++. Go is.. weird. I would even say it is a better Java.
Only when it gets generics, real enumerations, dynamic loading support, proper dependency management for large scale projects.
But now with the buzz of Google Dart going around, I am afraid that, am I betting on the wrong horse? Is it the right to jump on Google Dart bandwagon? To be honest, it do looks promising.
Please guide me, what should I do, since I am a newbie, I want to take advantage of the fact that, since I don't know anything, I better learn something that have much promising future, and have an edge over technology.
I also think there are better choices than Dart if you want to learn something that will expand your mind. Dart strikes me as a very practical language.
ALL the committers are from Google and it is not an open standard which basically eliminates any chance that Mozilla/Apple will ever consider adopting it. And frankly with Apple dominating the mobile web without them any solution will never eventuate to anything.
It will get standardized in the not too distant future. [1]
> Apple dominating the mobile web
Huh? Android's market share is over 80%. iOS got about 13%. [2]
[1] http://www.ecma-international.org/news/Dart%20workshop.htm
[2] http://thenextweb.com/insider/2013/11/12/idc-android-hit-81-...
And don't forget that Apple customers are acknowledged as the more valuable (higher net worth, disposable income, tastemakers etc)
Standardized by Google, perhaps, but by nobody else. It will not be a multi-vendor standard.
It is probably best to start writing web apps, and not on learning many tools.
Furthermore Dart supports mixins, so it's not exactly single inheritance classes.
From product point of view, Google would be much better to port Android Dalvik to Chrome. You can run GWT Java code in browser years ago. Running the same code using JVM would be much faster with much less code change. 5-10 man-year would be enough to do the porting, and it will share work between Android and Chrome for years to come. Of course, it would be much boring research work though.
From performance point of view, asm.js gets much better performance with way less work. No matter how good Dart performs, it would never make sense to port high performance C/C++ game code to Dart, so you end up having to use both Dart + pNaCl, which is an awful solution. Technically, TypeScript is more interesting if Microsoft can keep it simple and fast, but I doubt Microsoft would make anything simple.
Even if you did learn Dart, you'd inevitably have to include external javascript libraries, so you'll have to know javascript anyway.
And Google is still actively promoting javascript in things like AppScript and Angular js.
Sure for special cases knowing those things can help get the very best out of your code, but for the other 99% of the time, it is not necessary.
(Edit: Not that I recommend Dart over JS necessarily, but I don't agree with your argument.)
But you DO need to learn Javascript to use Dart on web apps, so the comparison is irrelevant.
For things like CoffeeScript, which are fairly thin layers over another language, I'd always advise to just learn JS first. Dart and Clojurescript though are so far removed from their compilation target that you don't really need to know the JS, as long as there's good library support for what you want to do. In the case of clojurescript the interop is so seamless that it puts the focus on learning the APIs, which is where the true complexity lies. Of course, and even more so with typing, you also have the compiler to back you up.
It really compiles, so you don't have to worry about it. The languages are so similar that stuff that is fast in Dartium will work pretty fine in JS.
* Blossom
* Montage
* Soundtrap
* Mandrill
* Google's internal CRM app
* Google Elections
Companies that started to add support for it: Adobe, drone.io, and JetBrains
No, that's not the case. You need to understand the browser DOM, and the various APIs available to you, but these are presented by Dart libraries. If you have knowledge of Java or C#, then that knowledge will be useful, and if you have knowledge of JavaScript's functional elements, then that is also useful, but none of that is mandatory to be effective with Dart.
Their JS engines are woeful. Even if you can get something app-like (the kind of thing you would use dart for) to work, your app won't scale w.r.t. perf so you're painting yourself into a corner.
If you'd like the future to be as good as possible, you might want to build new tools without the same old constraints.
[1] https://groups.google.com/a/chromium.org/forum/#!topic/blink...
They are working on an experimental solution to let garbage collection happen for DOM nodes that are created from Dart or V8. This basically requires a rewrite of the memory management of DOM nodes. This is still very much a work in progress and not ready for prime time.
The solution the team uses for Dartium is not the same as what they want to do for the shipping version of Chrome, so it'll be a bit before that's ready.
Probably because Dartium (Chome w/Dart) doesn't yet have the kind of performance advantage that makes it compelling enough to split the web that way -- making developers use dart2js for client code means that you don't need separate client code for Chrome (Dart) and everyone else (JS) -- and needing to commit to extended support of two different scripting runtimes in Chrome for the future.
Silverlight and ActiveX have already shown the usefulness of proprietary enhancements.
No thanks.
Browser vendors are free to integrate the VM into their products, and if they don't want to there is dart2js which is acceptable.
This isn't even close to the situation presented by Silverlight, ActiveX and I feel like you're being duplicitous by comparing them.
That's a tremendous amount of effort and it is likely to reduce the performance of JavaScript. Cross-language GC, in particular, is really hard. See Filip Pizlo's message to webkit-dev on this subject (citing two recent papers), which is part of the reason that Dart support was shot down when Google proposed adding it to WebKit: https://lists.webkit.org/pipermail/webkit-dev/2011-December/...
The Dart VM is nice but its primary purpose right now is running the Dart compiler and in Dartium which is only used by developers. (You can use it for other things but the ecosystem isn't there yet.)
This is a really good reason why dart2js exists and why so much effort has been expended in making it good.
However, I think that if Dart proves to be a compelling platform for developers I don't think it's out of the question for browser vendors to put some serious thought into integrating the Dart VM natively alongside JS.
After all, Google is going to be doing exactly that with Chrome/Chromium...
No they aren't. Integrating a Google-controlled VM into any software project (for example, Firefox) isn't trivial (you need lots of resources for it) nor is desirable (the technology is driven and controlled by Google).
Google being the ONLY committers don't exactly have a motivation to.
Dartium and dart2js already aren't quite in sync; numeric types work differently for example. But they're close enough that for most apps, you can develop in Dartium and deploy on dart2js and the language differences don't really bother you. The language differences between Dart-in-JavaScript and Dart-in-Dartium are a lot less than the differences between browsers that web developers deal with all the time.
So, yeah, Google has a motivation to keep it up to date.
Can't wait. I am already using Chrome, if it works best I'll like it even more.
> Silverlight and ActiveX have already shown the usefulness of proprietary enhancements.
So how do I compile Silverlight to .js again?
> No thanks.
Yes please!
Oh, and by the way, ActiveX would be awesome if it didn't have all the security flaws and was more portable. Too bad it didn't work.
1. Standards. The Dart VM is not part of any web standard, nor part of a spec that has interest from multiple vendors, so it should not be shipped in a standards-compliant browser. This is a matter of principle that most browsers agree on these days, see for example Google's Blink guidelines: http://www.chromium.org/blink#new-features
2. Effort. Adding a new VM into a browser is a huge amount of effort. The VM can't just be added even if it is open source (which it is) - it's very hard to integrate such a thing properly into a browser, technically speaking. Also aside from technical effort, there is also effort to start a new standards process for a new language.
I can see how many would see that as tail wagging the dog. But I see your point. And I agree it should be part of a standard. However I would imagine (and correct me if I am wrong) it is a lot easier to approve and go through the standard approval if there is already an implementation out there to look at. Standardizing on a hypothetical future feature via a large committee, doesn't work too well.
> 2. Effort.
Here, again, this is not a hypothetical, we haven't proven if it is possible we are just dreaming about adding a VM. Dartium works today. Presumably other would have a bit less work to do but it depends on how DOM interaction differs between them.
EDIT: 2nd part initially completely didn't make sense
Which is... exactly the same situation JavaScript was in when Netscape introduced it.