Dart Website Relaunch with 1.0 Release
dartlang.org
dartlang.org
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.
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.
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.
Really hope they're able to keep investing in Dart, they've got an amazingly talented team and IMO Dart's one of the few languages in recent times with the engineering prowess and right focus on fast iterative development, speed, simplicity, flexibility and consistency that's pushing comp-sci forward.
nit - The Dart team have explicitly said that they are not doing any features based on new computer science research. The Dart project is built on pragmatic engineering decisions, rather than "pushing comp-sci forward".
This is a good thing in my opinion.
Sometimes it pays off to watch the sessions. :)
A good developer should try to get as much information as possible about his/her tooling.
I remember the days where all I could learn about computers was trial and error, helped by what the local library could offer, if anything.
As long as the Dart specification is not governed gy a body encompassing all major browser vendors, this is a very dangerous development (And yes, I know that being governed by a standards body seriously hampers the evolution of a standard, but everything is a tradeoff...)
This is nothing like IE, which is actually proprietary and closed-source. In contrast, there is absolutely nothing about Dart that's proprietary. Dart is 100% open source, including patents grants, it's completely developed in the open and for the last 2 years has seen steadily progress with feedback from the public mailing list. It's actually a goal for the project that everyone is able to freely use Dart in any capacity. Lars Bak already said that after 1.0 is shipped they're going to work on getting the language standardized. There is nothing legal or technical stopping other browser vendors using Dart, any hesitations are 100% political.
Dart is finally the first real alternative where we may be able to progress beyond JavaScript, that as a core objective also compiles to first-class JavaScript, i.e. many features dismissed because it couldn't be efficiently transpiled to JS. I care about progress, the current state of web development is fragmented and broken, we need to be encouraging more initiatives like Dart that challenges the status-quo and is able to progress past the fragmented inconsistent mess we have to deal with now in trying to develop complex, rich, high-performance web apps.
Also Google has shown signs of embrace, extend extinguish when it comes to essential parts of Android, which makes me a bit wary.
I would love nothing more that Dart superseding JS as the goto language (and compile target) for browser development, as it is doubtless a step forward. But there are pitalls hidden on the way there and the outcome is determined by the path we will take.
Of course hesitations are political, because the outcome will be determined by political actions of everybody involved, Google, MS, Apple and Mozilla. Technical merits alone don't guarantee a happy outcome, sadly.
Luckily unlike other walled gardens, the quality of Dart2JS, i.e. first-class source-maps support and many benchmarks showing it even outperforms hand-crafted JS, ensures that Dart apps will continue to benefit and run in other modern browsers even without their support, where the only difference will be the start-up and runtime performance of the running code, so we end up getting it back down to technical merits.
> Dart maybe open source but it still a proprietary, non-standard solution
You use the word 'proprietary' but I don't think it means what you think it means. It doesn't mean you have complete access to the entire source code implementation and freedom to use all of it or any of it, in anyway you see fit. It doesn't describe a project that's driven by feedback in a public mailing list, that welcomes external feedback and contributions, and it's rarely used to describe a project with a core goal for it to have no-legal-or-technical-barrier, free access, encouraging its wide-spread adoption.
By your definition most Open source projects are proprietary and non-standard, where most programming languages aren't even standardized, the difference with Dart is that it actually has the commercial backing that can justify the effort in actually getting it standardized, which it plans to do now that Dart 1.0 is shipped, just as Lars Bak announced at Google IO.
Again like many OSS projects, the Dart project has taken external contributions, but the brilliant minds that Google have brought in to work on Dart full-time are indeed being paid to do so. It's not uncommon, to accept Q/A verified external contributions but to ensure only employees have free reign and project-wide commit access. Even Dart's internal contributions still have to go through a Q/A code-review process.
Web Components and polymer is a good example of the power and re-use enabled by encapsulation. The http://www.polymer-project.org goal is that you can integrate and re-use Dart web components, Angular JS components, Firefox x-tags, etc within the same web app. Which is unprecedented in the fragmented world of JS.
Why would anyone do that? We have a super nice solution for that. It's called "site-specific browser" or SSB.
It's like a browser without address bar, which automatically opens a specific URL on start up.
You can have one per intra-/extranet application and you can update them individually on a as-needed basis.
You get all of the benefits of a fixed platform without any of the downsides. Well, you'll need a little bit more RAM and and a little bit more HDD space, but that really shouldn't be an issue.
These situations can sometimes happen by accident or for technical reasons. And for me the web is far too important to take the risk.
> Dart has all the perils of an embrace and extinguish situation even if it is not the intention.
I'm not sure what you mean by "perils" here, but if it's just "by deciding to use a product, you could end up following it in a bad direction if they do that", I'm not sure how that's different from any other product. Any technology can go in unpredicted directions.
> Developers commit to Dart only to find in the future that the DartVM/Dart2JS targets have differing behavior or levels of attention.
Historically, the dart2js team has had as many or more resources than the VM team. If you consider the past a predictor of the future, then this shouldn't be a concern.
> And then suddenly Dart apps require Chrome and we end up with same IE6 mess again.
That would be pretty crazy of us, though, right? We want our language to be successful. Intentionally making it only work on a minority of browsers (and the unbelievably massive negative political repercussions of doing that) wouldn't exactly do much for Dart's adoption.
I'm trying to imagine some nefarious scenario where that could happen, and I'm having trouble conjuring one up.
Evil Chrome exec: Well done, minion! Dart is successful and has
lots of users! Now is our chance to attack!
Evil Dart exec: What have you in mind, O Master?
Evil Chrome exec: Now we'll add a feature to Dart that only the
VM supports. Users will have to use Chrome in order to run apps
that use that feature! Mua-hahahaha!
Evil Dart exec: But master, why would a developer use that feature
if they know it will prevent millions of users from running their
app?
Evil Chrome exec: Uh... it will be such a delightful feature they
won't be able to resist. Like... I don't know, currying or
something.
Evil Dart exec: But what happens if someone just sends us a patch
to implement it dart2js too?
Evil Chrome exec: Well, don't land it, obviously!
Evil Dart exec: What should we say in the code review?
Evil Chrome exec: Why do you bother me with these details? Just
move ahead with our plan!
Evil Dart exec: Remind me again what our plan is master?
Evil Chrome exec: To force the world to use Chrome! Soon, we will
be as successful as IE6 was!
Evil Dart exec: Not to question your wisdom, master, but IE is no
longer the dominant browser, so that didn't work out well for
them, did it?
Also, developers now universally revile IE because of their
practices. We'd be shunned if we did something like that.Edit: Consider this dummy example:
f(a, b) { return a + b; }
With operator overloading, the compiler has to account for that, and must transpile to e.g. function f(a, b) { return __invokePlus(a, b); }
Unless the programmer adds type hints f(num a, num b) { return a + b; }
Edit: mraleph told me that I'm incorrect - apparently the transpiler does global type inference on the code and will only generate a function call if the type needs it (or if it can't figure out the type)Exactly right. We need to do that, or numeric code would be impossibly slow when compiled to JS.
Dart VM features an classical adaptive optimizations pipeline that first gathers type information from the run and then optimizes hot methods using collected type feedback to specialize the code.
For more implementation details about Dart VM optimizing compiler you can check out my talk from Strange Loop 2013 http://s3.mrale.ph/StrangeLoop2013.pdf
It ships with a dart2js compiler that you can use in VS. However, to really get the ease of development you're looking for you'd probably use VS to build/debug the backend, and additionally, the dart editor (special eclipse version) to debug the front-end. You'd have to enable your backend to support CORS calls for this type of setup. However, Once you are ready to deploy, the app builds to HTML/JS/CSS files that you can just embed normally in your solution.
I think what you're getting at is - is it better than JS or typescript + angular or backbone? It'd probably a matter of taste. The language is different from the "syntactic sugar" on top of JS that typescript is. Dart lets your bridge to standard JS libraries (i.e., Jquery etc), but, it also provides most of the functionality in the standard library. It provide a built-in unit test and logging framework and a nuget style repository of other libraries. Additionally, Dart's Polymer library provides an MVVM framework. You can define controls and combine into single-page webapps.
I still don't see any enterprise requests for CoffeScript, TypeScript or any other language that targets JavaScript.
When you work in teams, everyone across the company that needs to touch the source code needs to know the respective technologies.
That is true, but then I'm not sure they offer as much as Dart does. (Plus I bet some MS shops use TypeScript).
You would think, but how many people developing Objective C know C well, it's more true in the beginning but as you go on the need to know about the target runtime diminishes. Do you know much about the JavaScript VM in the browser and how that compiles to C?
> Do you know much about the JavaScript VM in the browser and how that compiles to C?
Of course, if you want to write JIT friendly code you need to know the magic JavaScript incantation code patterns.
There is a reason why all browser vendors have developer sessions on their conferences about those patterns.
Other compilers offer similar flags.
And before you ask, Assembly manuals explain how many cycles an opcode takes and what are the expected side effects on the chipsets.
GWT seems to have been widely used.
Plus GWT uses Java, a widely supported enterprise language.
Because I have and continue to for the last 20 years and NOBODY is interested in a repeat of the IE6 fiasco.
We still have to support that far back, which has issues with a lot of frameworks and in this case Dart.
I don't think enterprise IT departments will ever subscribe to the always update nature of Chrome 1, so it just means more and more IE6 situations down the line.
1 We actually have an app that IT install that prevents you installing Chrome :p
All other banks with similar apps have the same targets as far as I know. (HSBC, JPM, MS, RBS, Barclays etc)
Actually it's not supported in any standards-compliant browser and only available in Google Chrome.
That makes it a bit of a no-no.
Yes, but most people who write web apps don't like Java syntax. Publicising Dart without changing that won't stop the low adoption Dart's had for the last two years.
Edit: a reminder that that was the biggest piece of feedback from Dart announcement 776 days ago: https://news.ycombinator.com/x?fnid=oEG20axbbQ4CeS0NXvabbv
In type inferenced statically typed languages like ML, Scala, or Haskell, you can get away with not mentioning the types in the bodies of most functions. The type declarations at the library level serve as useful documentation.
I write plenty of code at all layers that would benefit from being able to accept code as an argument. If I want a private helper method that takes some code as an argument, do I have to create and name a function interface just for that?
Yes, Javascript's anonymous function syntax is needlessly verbose, but that's trivially fixed and will be in future versions. Changing Java to not need a function interface is a much bigger challenge that I'm willing to bet won't come about for a long time, and is going to be a source of frustration for lots of people as they realise how useful cheap anonymous functions can be.
You don't really need to create any function interfaces for most expressions since the most common ones are pre-defined (Supplier, Consumer, Predicate, Function, UnaryOp, BinaryOp, etc), and the basic rules allow a lot of flexibility.
I've been doing a lot of Java8 recently due to work integrating it into GWT (https://plus.google.com/+RayCromwell/posts/C4QYmWWQguT) and the experience has been delightful. In actual use (as opposed to testcases), it's been very economical, especially the this::foo constructor vs the JS equivalent which needs bind(), and the fact that you get good auto-complete is great.
Even with the provided function interfaces I worry there will be cases they don't cover which means people won't use anonymous functions where they're useful.
However, given you seem to have used Java 8 and. I haven't, I'll relent :)
The fact there is a new fashionable language in the valley doesn't mean it's going to be popular world wide.
Agreed re existing java developers though. But even in the java community, scala syntax is popular for the same radios dart is unpopular for web devs. I've seen more typescript interest than I have dart interest, again because type safety has nothing to do with unnecessary verbosity.
Languages have users just like programs do. We know, as developers, that making users do extra work is poor. Java is renowned as the 'I studied computer science at university but...' language. Why is Google unnecessarily repeating the mistakes?
Google: make dart 2 cleaner and you'll immediately engage not just java users, but existing web developers and people new to software as well.
There are definitely early adopter, bleeding edge types who love to look at things that are brand new. But we've gotten a lot of feedback from developers saying they are interested in Dart but not comfortable using it in mission-critical apps when the language is still changing.
Going 1.0 is a big deal for those people.
> I've seen more typescript interest than I have dart interest, again because type safety has nothing to do with unnecessary verbosity.
I'm not sure what you mean here. My experience has been that Dart is a good bit more terse than TypeScript (getting rid of "this." everywhere certainly helps). Are you trying to say Dart is unnecessarily verbose, or that that doesn't matter?
Yes. See other posts.
And on large projects which are the domain of Java/.Net developers you often have dedicated Front End developers anyway.
Working on large scale (tens of developers) web apps has serious issues with JS, and Dart can address some of that.
I don't expect to see AirB&B running via Dart, but Gmail, Google Docs etc will really benefit, and hopefully pave the way for some serious desktop caliber applications.
Not true, at least not in my case :)
There are webapps that use Java (or any JVM language) on the back-end and JavaScript on the front-end.
Check out Addy Osmani's "Making Maven Grunt": http://addyosmani.com/blog/making-maven-grunt/
Sure, but for different reasons: principally, lack of type safety. That's completely orthogonal to syntax.
> lack of wrapper classes, wrapper functions, lots of brackets
That's 3 items of 5. Of those 3:
- All the demos use wrapper classes and wrapper functions and I'm getting conflicted reports on whether Dart requires them or not (see munificent's post for example). If none of this junk is required, ditch it in the public docs.
- Not sure why you think Dart doesn't need brackets, it clearly uses them for blocks.
I thought you were referring to wrapping functions to return modules in JS. Or over use of anonymous functions that leads to confusing brackets and pyramids of curly brackets.
- Python, Ruby, Coffee don't require wrapper functions and classes for small examples, eg hello world or the Fibonacci example on dartlang.org. That said, another commenter mentioned the examples for Dart include these wrappers needlessly so this may be a documentation problem. - JS, Python, Coffee, Ruby and Scala drop semicolons to terminate statements (which users already mark with line terminators)
- Python and Coffee ditch the marking blocks with braces (which users already mark with indentation)
- Python, Scala, Ruby, and Coffeescript set either 'public' or 'private' as a default for new methods, so users don't have to specify unless they want the non-default behaviour.
(I have very little knowledge of PHP but from what I've seen it's generally not as chatty as Java either)
* Most of the popular languages use braces for blocks. I sort of like significant whitespace, but it brings a lot of other problems. In the end braces are a pragmatic choice and have very little bearing on the utility or usability of a language.
* Dart also has a default visibility: public. You change it to private by adding a leading underscore.
Fix the docs, ditch the semicolons, and Dart may get more popular.
I think marking up blocks twice is a waste of time, and leads to the possibility of inconsistencies between indentation and parenthesis, but appreciate using indentation for blocks is too different for some existing programmers.