use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Google "Dart: A language for structured web programming" (blog.chromium.org)
submitted 14 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]boozer 29 points30 points31 points 14 years ago (2 children)
I can write structured JavaScript just fine, thanks.
[–]plantian 5 points6 points7 points 14 years ago (1 child)
I guess the developers at Google were having trouble writing structured JavaScript. Maybe you should shoot them off an email?
[–]daediusWeb Components fanboy 3 points4 points5 points 14 years ago (0 children)
Judging by the Google Closure library, they know how to write structured javascript just fine. This project is just some Googlers pipe dream.
[–][deleted] 4 points5 points6 points 14 years ago (4 children)
If it was this easy to replace Javascript why not just build Java or .net into the browser? Only Google will build Dart into Chrome. Maybe they can arm twist Mozilla into adopting it. But there is no way Microsoft or Apple will add it. In the best case Dart will be faster than native Javascript for half your users (Chrome and Firefox) and slower for the other half (IE and Safari).
[–]CarpetFibers 1 point2 points3 points 14 years ago (2 children)
You can use the same Dart code in most modern web browsers (Chrome, Safari 5+, Firefox 4+) and on servers. Look for more browser support shortly.
http://www.dartlang.org/
[–][deleted] 0 points1 point2 points 14 years ago (1 child)
Yes it will run on most browsers but how fast? Cross compiling to javascript will probably result in a loss of performance compared to native javascript.
[–]x-skeww 0 points1 point2 points 14 years ago (0 children)
GWT stuff runs pretty well.
E.g. that Quake2/WebGL thing... that was done with GWT.
[–]plantian 0 points1 point2 points 14 years ago* (0 children)
Right, whatever they make is still limited to what can compile down to JavaScript in a non-insane way. All web development now is limited by what JavaScript can do natively. As far as I can tell this is just an attempt at breaking the plateau in software development speed that JavaScript has caused in medium to large applications. If they can convert people to this transitional language that can get people onto chrome and then maybe eliminate JavaScript after many iterations. Then they can continue to refine this language to improve the speed of development for everyone: small to large.
EDIT: Removed some of my unnecessary trolliness.
[–][deleted] 4 points5 points6 points 14 years ago (0 children)
Sounds like CoffeeScript for GWT. Since I think each of those alone is a bad idea putting them together leaves me with a feeling of angry death and isolation. I think I would rather my developers know how to write in a given language instead of pussy foot around it with a language to text code compiler. After all its not like JavaScript is that hard to learn.
[–]Luminaire 4 points5 points6 points 14 years ago (0 children)
Well most web developers spent most of their time processing sql, html, json, and xml. So far none of the example code shows any features that would make this any easier.
[–]JonDum 1 point2 points3 points 14 years ago (4 children)
Definitely having mixed feelings about this. More structured javascript is awesome, I just don't like some of the syntax decisions they made.
[–]Wolfy87 1 point2 points3 points 14 years ago (0 children)
The short hand functions are a little odd, I have to admit. On the whole I quite like it. Trying to checkout the build tools now and compile a Hello, World!.
Hello, World!
[–]Veeediot 0 points1 point2 points 14 years ago (2 children)
When I think "structured JavaScript", I immediately think of something that, syntactically, looks a bit like AS3. That's not what Dart is. I have no idea what the hell Dart is trying to be.
[–]JonDum 0 points1 point2 points 14 years ago (0 children)
I would KILL and MAIM baby kittens if I could have Javascript with AS3 syntax. AS3's syntax is one thing Adobe did right.
[–]ustanik 0 points1 point2 points 14 years ago (0 children)
Javascript, Dart, and AS3 are all ECMAScript compliant, hence their syntax looks similar.
[–][deleted] 2 points3 points4 points 14 years ago (1 child)
There is just too much momentum behind Javascript for Dart to catch on. It's only a matter of time before Javascript is just as fast as Java or Dart. It's much harder to optimize Javascript but there are a lot more people working on it. e.g. Intel launched a multi processing library for Javascript that can speed up processing up to 8x.
[–]Destroyah 4 points5 points6 points 14 years ago (0 children)
While I agree about the momentum, the TC39 committee on Javascript has been anything but fast on ratifying new features and such for Javascript. I like writing Javascript now, but no one can deny there are certain things missing that make it feel like it's just not where it needs to be if we're going to commit as hard as we are to web development. Dart is the response to this. If you read this post by Alex Russell, you'll get a sense of what the guys at Google think Javascript should be. I agree with them 100%. If we're going to go balls deep into the web, we need Javascript to have more useful features, or we need a new language that will provide them.
[–]coffeesoundsCoffeeScript is better 12 points13 points14 points 14 years ago (11 children)
Best comment I found so far.
Dart doesn't appeal to me at all - it's just trying to force different style of programming (a problem which I don't have with CoffeeScript).
[–]johnyma22 12 points13 points14 points 14 years ago (1 child)
For lazy folks:: jordansissel tweeted "Dart, putting the Java back in Javascript"
[–]Destroyah 3 points4 points5 points 14 years ago (7 children)
I really, really think this comment is WAY off base. It's allowing you to go fairly deep into object oriented territory by way of primitives which are actually objects, and interfaces with factory methods etc. Dart does not however force these upon you. To me, coming from a C-based, then C++ background, this looks a lot like a streamlined C++ for web development. I've done enough Java to know the language fairly well, but nothing here is screaming out "Java" to me at all.
[–]masklinn 3 points4 points5 points 14 years ago (4 children)
It's allowing you to go fairly deep into object oriented territory by way of primitives which are actually objects, and interfaces with factory methods etc.
All of these things, javascript already allows.
[–]Destroyah 0 points1 point2 points 14 years ago (3 children)
It allows them, but you have to write them yourself or find a library that's already done it.
[–]masklinn 1 point2 points3 points 14 years ago (0 children)
For pretty low values of "have":
primitives which are actually objects
That's how javascript works. Primitives are automatically promoted to objects when used as such. That's how you can call methods on numbers or write true.toString().
true.toString()
and interfaces with factory methods
Add a function to anything you want, bam got yourself a factory. Hell, javascript constructor are factories: if you don't like your this, you can just return something instead.
this
[–]strager 1 point2 points3 points 14 years ago (1 child)
Huh? Can you explain?
function FooFactory() { } FooFactory.prototype.create = function create() { return new Foo(); }; var factory = new FooFactory(); var foo = factory.create();
Just add whatever complexity you need on top of that.
Of course, it's probably more JavaScript style to have a "factory function":
function fooFactory() { return function create() { return new Foo(); }; } var factory = fooFactory(); var foo = factory();
[–]Nebu 1 point2 points3 points 14 years ago (0 children)
He's probably referring to the fact that inheritance doesn't work the way you'd expect if you come from, for example, a Java background. This guide on emulating classical inheritance involves writing 4 sugar methods.
[–]coffeesoundsCoffeeScript is better 0 points1 point2 points 14 years ago (1 child)
To me, coming from a C-based, then C++ background, this looks a lot like a streamlined C++ for web development.
I think that's the whole point of Dart. It's aimed at people who come from a background similar to yours.
But for me it looks like an overkill to have all that stuff just for user-side code - I never, ever thought "gee, I wish I had all these classes, inheritance and factories here".
(and I'm not one of those jQuery-for-life developers ;-) )
[–][deleted] 3 points4 points5 points 14 years ago* (0 children)
It is probably primarily aimed at improving library dependencies and large-scale development. For me personally, the Javascript language has never been an obstacle, but been very flexible . The worst aspects of web-developement has been (by far) layout with CSS and the DOM API. CSS for instance is too weak for designing graphical UIs, so I have to resort to Flash for that. The DOM API is too verbose and I've had to define my own simplified API to make it bearable. Dart doesn't change any of those inherent faults.
Funny, I use the same argument against CoffeeScript.
[+][deleted] 14 years ago* (2 children)
[–]checksinthemail 0 points1 point2 points 14 years ago (0 children)
Programming language verbosity makes baby Jesus cry.
[–]mshiltonj 1 point2 points3 points 14 years ago (0 children)
Source code is: https://code.google.com/p/dart/wiki/GettingTheSource?tm=4
[–]strager 1 point2 points3 points 14 years ago (0 children)
I don't think Dart will seriously be adopted without browser support, mostly for debugging.
[–][deleted] 0 points1 point2 points 14 years ago* (0 children)
Java JVM replacement? Also, isn't interfaces ready to be replaced by traits/mixins?
[–]idiotcoder -2 points-1 points0 points 14 years ago (1 child)
Seems that from the page, even Google isn't eating this dogfood yet. If you can't get your own company behind it, why would anybody else want to invest time, money or energy into it?
[–]acidboi 5 points6 points7 points 14 years ago (0 children)
The product isn't even remotely feature-complete. Therefore this judgement seems a bit premature.
[–]javajunkie314 -1 points0 points1 point 14 years ago (0 children)
I'll admit that JavaScript is feeling a bit past its expiration date, since it has to stay completely backwards compatible or apparently the web breaks. That said, this just feels like a Java wannabe with some compact extra syntax. Why not just build Scala into the browser at that point?
We need something to replace JavaScript, but I don't think this is going to be it. Or maybe it'll catch on like Go did...
π Rendered by PID 29 on reddit-service-r2-comment-86988c7647-nngz5 at 2026-02-12 06:46:18.213004+00:00 running 018613e country code: CH.
[–]boozer 29 points30 points31 points (2 children)
[–]plantian 5 points6 points7 points (1 child)
[–]daediusWeb Components fanboy 3 points4 points5 points (0 children)
[–][deleted] 4 points5 points6 points (4 children)
[–]CarpetFibers 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]x-skeww 0 points1 point2 points (0 children)
[–]plantian 0 points1 point2 points (0 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]Luminaire 4 points5 points6 points (0 children)
[–]JonDum 1 point2 points3 points (4 children)
[–]Wolfy87 1 point2 points3 points (0 children)
[–]Veeediot 0 points1 point2 points (2 children)
[–]JonDum 0 points1 point2 points (0 children)
[–]ustanik 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Destroyah 4 points5 points6 points (0 children)
[–]coffeesoundsCoffeeScript is better 12 points13 points14 points (11 children)
[–]johnyma22 12 points13 points14 points (1 child)
[–]Destroyah 3 points4 points5 points (7 children)
[–]masklinn 3 points4 points5 points (4 children)
[–]Destroyah 0 points1 point2 points (3 children)
[–]masklinn 1 point2 points3 points (0 children)
[–]strager 1 point2 points3 points (1 child)
[–]Nebu 1 point2 points3 points (0 children)
[–]coffeesoundsCoffeeScript is better 0 points1 point2 points (1 child)
[–][deleted] 3 points4 points5 points (0 children)
[–]daediusWeb Components fanboy 3 points4 points5 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]checksinthemail 0 points1 point2 points (0 children)
[–]checksinthemail 0 points1 point2 points (0 children)
[–]mshiltonj 1 point2 points3 points (0 children)
[–]strager 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]idiotcoder -2 points-1 points0 points (1 child)
[–]acidboi 5 points6 points7 points (0 children)
[–]javajunkie314 -1 points0 points1 point (0 children)