6 ms·
I really fail to see the point of Dart, especially since awesome client side frameworks like Angular already exist. Why doesn't Google throw more resources at
by adamors 13y ago
I really fail to see the point of Dart, especially since awesome client side frameworks like Angular already exist.
Why doesn't Google throw more resources at them instead of creating something from scratch that has a very high possibility of being abandoned in the next 2-3 years.
- WoodenChair 13y agoBecause writing/improving yet another JavaScript client side library fails to address the fundamental flaws with JavaScript which are well laid out. ECMAScript 6 will likely correct some of these flaws, but the necessity for backward compatibility continues to be a stumbling block. Dart is a clean break and fresh slate while retaining a familiar syntax and interoperability/compatibility. Is it a long shot that it will unseat Javascript? Sure. But, competition is good for JavaScript. Google's number one interest is in improvement across the entire client side web app infrastructure since its business is built upon it. It can push Dart while improving JavaScript in parallel.
- nailer 13y agoI definitely agree that JS itself could be improved, but while Dart improves some things, it makes others a lot worse. Look at the Fibonacci program on dartlang.org, and compare it to any language that's popular with web developers: Python, ruby, Coffeescript or even scala. Multiply that unnecessary overhead for every function in your app.
- WoodenChair 13y agoYou mean the graphical one where they use storage, forms, and events? Let's not be misleading... Hello World in Dart is: main() { print("Hello World!"); }
- nailer 13y ago> main() { print("Hello World!"); } Yes, that's my point. Why not just print("Hello World!"), like everything else?
- munificent 13y agoThe top level of a Dart program is a group of definitions, like in Java or C#, instead of a series of imperative statements. That makes it easier for static analysis, since you don't have strange constructs like: if (itsTuesday) { class Foo { ... } } It also means mutual recursion just works, without weird semantic shenanigans like hoisting in JavaScript. In Dart, the top-level is "simultaneous": all of those definitions are static with no mixing of side-effecting imperative code at the top-level which would make ordering matter. The main side-effect of this approach is that you have to wrap your entrypoint imperative code in a main() function. It's a pretty small price to pay, especially in an application with thousands of lines of code.
- nailer 13y agoPersonally I don't mind hoisting but for the moment, OK. So obvious question: why doesn't the language create this entry point for me?
- spankalee 13y agoBecause once you allow statements at the top level alongside declarations, which statement should be run first? main() makes that clear. In JavaScript it depends on the order of script tags and their attributes. It's really hard to determine what code is actually run at application startup, and what the initial state is. Making the top-level only declarations means that the programmer knows what code runs first (the first line in main()) and the VM knows that the order of evaluating the declarations doesn't matter. It can evaluate them all and cache the result so that subsequent runs are fast, it can execute main() before other declarations and evaluate them on an as-needed basis, or something in between.
- 13y ago
- ahoge 13y agomain()=>print('Hello World!');
- WoodenChair 13y ago...parent changed comment from complaining about Hello World having too much boilerplate in Dart to being about something else entirely. This is why HN should not have an edit feature...
- nailer 13y agoI thought dartlang.org had a helloworld, instead it had a fibonacci. I updated to show an example people could see. Not sure why that's an issue.
- mythz 13y agoIf you're changing the message of your post, annotate it with an Edit leaving the original message in-tact, especially if it's found to be non-factual. Here you're invalidating all responses and making them sound non-sensical. Post a new message if you have something new to say.
- nailer 13y agoI'm not changing the message of the post. The only difference is the demo referred to. The point about Dart being too verbose made remains the same in both 'hello world' and 'fibonacci' cases as you can see, it was simply a matter of being in a cafe using a mobile phone where switching out to another tab, opening the golang site and finding a demo to check that they had the 'hello world' example most sites provide was difficult. The person attacking me for 'changing' my post has been on News.YC (ahem 'Hacker News') for 70 days, called criticism of the boilerplate code shown in the Dart demos 'FUD', and wrote three separate replies to the same point. Judge for yourself.
- WoodenChair 13y agoRight because length of existence of a username is really a good argument of anything... All of your posts attacking Dart are for nonsensical reasons, and then your replies are backsteps admitting part of what you originally said was wrong and then coming up with a new nonsensical argument. I don't know what you have against Dart, but your basic premise that it's verbose is absolutely wrong. They've actually taken pains in the syntax to not be verbose (factory constructors, => functions, getters and setters, .. syntax for cascades, etc). It just shows you judge the language based on glancing at the front page of the website for 2 seconds without doing significant reading. In other words your posts are FUD. I stand by that.
- WoodenChair 13y agoIn reply to your new comment about fibonacci. If you look at the actual function doing fibonacci, it's the same length as the equivalent fibonacci function in Java or Javascript... please stop spreading FUD.
- nailer 13y agoThe boilerplate is the issue, saying to ignore it is illogical. Unless it's not actually necessary in dart (mraleph says something in another comment) in which case it shouldn't be in the docs. I have no interest in or against Dart other than wanting to see a compelling modern alternative to JS. Not sure why you think criticising Dart and it's website is 'spreading FUD'.
- mraleph 13y agoFibonacci function in Dart can be as easy as: fib(n) => n < 2 ? n : (fib(n - 1) + fib(n - 2)); Examples on the main page just exists to show cases as much language features as possible. It does not say that you have to wrap your Fibonacci into a class.
- deleted 13y ago[deleted]
- nailer 13y agoMaybe it's a matter of bad docs giving the wrong impression then? Examples should be terse, the ability to create unnecessary wrappers don't seem like much of a feature to show off.
- mraleph 13y agoStrictly speaking it's not a doc. It's a snippet on the main page that tries to show case available language constructs. I do agree however that wrapping Fibonacci in a class looks a bit strange. Documentation that showcases features in the terse form is available at http://synonym.dartlang.org/ http://synonym.dartlang.org/ If you have better ideas you can file a bug or even submit a pull request for the site: https://github.com/dart-lang/dartlang.org https://github.com/dart-lang/dartlang.org
- nailer 13y agoWeb pages showing people how to do things are documentation. No inclination to contribute, Google have known that verbosity is a common reason for disliking Dart for 750+ days and haven't done much about it. I'm fine using JS and, when I want strong typing, know that Typescript is there.
- spankalee 13y agoYeah, I think the Fibonacci class example is odd too. I also would love to propose a self-imposed internet-wide ban on the recursive Fibonacci implementation as I'm pretty sure it causes brain rot and makes dynamic programming seem way more magical than it is.
- adamors 13y agoStill seems like throwing the baby out with the bathwater to me. Especially since its from Google; as it is, it looks like the second coming of ActiveX to me.
- WoodenChair 13y agoIt's a legitimate concern until you dig beneath the surface of the politics. The fact is that in the near future Chrome will not achieve IE 6 like market share and therefore Dart will primarily be used through Dart2JS. It's a legitimate fear for the future - but that's admitting then that Dart is a darn good step in the right direction and will see high adoption. At this time it's more of a straw man. Also Google has said they will submit Dart to a standards body. That was never going to happen with Active X. And of course, unlike ActiveX, Dart is open source - so if in a pinch Dart took over the world super rapidly and the other browsers had to incorporate it...
- robmcm 13y agoI think without Dart2JS this would be a non starter. I can't see Apple or Microsoft implementing a DartVM either an open source one or one of their own, remember the Flash Player was an open spec but no one wrote their own.
- dgregd 13y ago> I can't see Apple or Microsoft implementing a DartVM ... That's the whole point of Dart. Apple and Microsoft are protecting their closed platforms. They are not interested in open platforms like Web. Microsoft improved IE JS engine after they lost significant market share. And please compare features of C# and ECMAScript. Google pushed the whole web platform forward. I don't want them to wait for Microsoft acceptance!
- pjmlp 13y ago> Google pushed the whole web platform forward. Really? When do you expect other browser vendors to adopt DartVM and PNaCL? This is the second coming of IE, nothing else.
- richbradshaw 13y agoAngularDart does now exist – http://news.dartlang.org/2013/11/angular-announces-angulardart.html http://news.dartlang.org/2013/11/angular-announces-angularda..., I wonder if that is going to be the direction that Angular is taken?
- lennel 13y agoThe problem with angular here is that it eliminates tree shaking in the dart compiler. Angular has the same problem with closure as well. tis a big problem imo which the framework creators best fix.
- asb 13y agoIt is being worked on apparently: https://news.ycombinator.com/item?id=6731385 https://news.ycombinator.com/item?id=6731385
- pygy_ 13y agoSo far it's not clear cut. When Angular.dart was announced, some people claimed that it would become the default version, and that features would be backported to the JS version. There were strong rebuttals from googlers, but IIRC none of which from the Angular team itself. For v1.2, the Angular.js team has rushed the backport a controversial feature[1] from its .dart counterpart three weeks before release, months after the first RC was released, breaking the meaning of a release candidate. :-/ -- 1. the underscore prefix to make $scope fields private.
- robmcm 13y agoDart is a language and VM, not a framework. A framework aids your development and provides tools, it doesn't fix shortcomings in language and runtime.
- levosmetalo 13y agoI totally agree on that. What makes Dart better than, for example, GWT or Coffeescript? In the end of the day, it's just a new language targeting JS. And that new language is doesn't have any advanced or interesting features except for the name of the company that created it.
- jhawk28 13y agoJS is one aspect of Dart. Using the same language server side is the other. It really seems like a competitor of JS/NodeJS. They do have the challenge of convincing the JS world that the new system is better enough to warrant learning a new language. If it succeeds, it will be interesting to see if it is the Web side or the server side that drives adoption.
- spankalee 13y agoDart's better than GWT because it's a modern language that is actually designed the be compilable to JavaScript. Not all of Java is compilable to JS, so GWT is really a subset of Java, but it's still verbose. Dart's much more concise and easier to translate to JS, so it's compiler is much faster too, but also adds getters and setters, mixins, operator overloading, implicit interfaces (every class defines an interface), top-level functions, optional typing, (and things Java's just gettgin:closures, collection literals). Dart and it's core libraries being designed for a single-threaded, asynchronous world is a big deal and makes it much more at home in a browser than Java. Where they're similar is in the ability to have tools and libraries that work well together, and mostly sane semantics. Dart's better than CoffeeScript because it dramatically improves on the semantics of JavaScript. Libraries, classes, interfaces, mixins, only explicit type conversions, lock scope, privacy, no monkey-patching, fixed this binding, final, constructor initializers, optional typing... these are all things that make large programs easier to manage, and tools easier to write. CoffeeScript offers a couple of minor fixes like this binding, but basically is just a different syntax for JS. If Dart were just a different syntax, it wouldn't be worth it, but spend some time with the Editor (or WebStorm) and see the static warnings and errors, refactoring, code-completion, code navigtion, etc. and you'll see how it's miles better for teams.
- xxgreg 13y agoFYI - the Angular team have ported Angular to Dart.