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.
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.
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.
Yes, that's my point. Why not just print("Hello World!"), like everything else?
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.
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.
OT: script tag soup is, for first party stuff anyway, avoided with a single script for a module loader these days.
This is not really possible if you must interpret top level code to build up your top-level declarations, as done in JS.
Using snapshots, the Dart authors have said it should be possible to improve script start up time by 10x over V8. This is a big win for large script heavy apps.
Edit: link https://www.dartlang.org/articles/snapshots/
Also, if you import a library that contains this top-level imperative code, how do you invoke it? Is it invoked automatically? When? How does that play with cyclic imports?
The small amount of overhead of a main() method solves all of that.
Here you're invalidating all responses and making them sound non-sensical. Post a new message if you have something new to say.
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.
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.
Yes, if the user is lecturing others on HN etiquette.
> All of your posts attacking Dart are for nonsensical reasons
If you think terse syntax and good quality documentation are nonsense then you are welcome to think so, I wish you the best of luck.
Cool. Send a pull request to the dartlang.org maintainers and they might fix it. ;)
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'.
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.
Documentation that showcases features in the terse form is available at 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
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.
+ the laziest way to do memoization:
var cache = new Map();
fib (n) => cache.putIfAbsent(n, () => n < 2 ? n : fib(n - 1) + fib(n - 2));
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...
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!
Really? When do you expect other browser vendors to adopt DartVM and PNaCL?
This is the second coming of IE, nothing else.
Completely Baseless, opinionated, inaccurate, hyperbolic, HN comment, check.
Google is NOT pushing the whole web platform forward. They are pushing THEIR web platform forward. We saw it with SPDY and now seeing it again with Dart. Technologies developed in isolation that only see traction due to the popularity of Chrome.
Sometimes the only way to push things forward it to do it in isolation, make leaps and bounds, and then present it as an open standard.
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.
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.
A framework aids your development and provides tools, it doesn't fix shortcomings in language and runtime.