Skip to main content


Showing posts from August, 2012

New try/catch syntax ready to use

Posted by Kasper Lund We're very close to being able to turn off the support for the old try-catch syntax. Early next week attempts to use the old syntax will lead to compile-time errors. The new syntax already works today so now would be a fantastic time to update your code. The old syntax like:    try { ... } catch (var e) { ... }    try { ... } catch (final e) { ... }    try { ... } catch (T e) { ... }    try { ... } catch (final T e) { ... } translates to new syntax like this:    try { ... } catch (e) { ... }    try { ... } catch (e) { ... }    try { ... } on T catch (e) { ... }    try { ... } on T catch (e) { ... } and the local variable introduced to hold the reference to the caught exception (e) is implicitly final in all cases. Why did we make this change? The M1 Updates article explains it best.

Dart API docs get 83% more awesome

Posted by Seth Ladd There are a lot of classes in the Dart API, and it's now much easier to find what you're looking for thanks to a new "find as you type" search feature on . Thanks to Johnni Winther for building this feature. Enjoy! As always, we appreciate your feedback and comments. Please join us on the Dart mailing list and Stack Overflow .

Notes from weekly Dart language review

Posted by Bob Nystrom Here's my notes from this week's meeting. As usual, the meetings are fairly low key as we move towards M1. Instantiating abstract classes We're starting to move code from interfaces to abstract classes. We noticed a nasty pattern some people were doing where they made a private factory constructor just to get rid of the default constructor so that a class couldn't be constructed. We don't want people doing that. So, instead, we'll make it a dynamic error to instantiate an abstract class. (Abstract class meaning a class that defines an abstract method or is explicitly marked "abstract".) This is already a static warning in the editor, but we will make it an outright error at runtime. If you relied on this behavior, now you'll just override any abstract methods with empty bodies or throws or something. Kasper pointed out that we can always loosen this up later if the above proves to be problematic. Ma

#resource is going away, update your code

Posted by Seth Ladd Today, Dart team member Kasper Lund notified us of a breaking change. The #resource directive is being removed from the spec and implementations. From the email: We've decided to remove support for the #resource directive and instead rely on metadata annotations for associating external resources with Dart programs. I've submitted a change that removes the support for #resource from dart2js in r11489 and the other implementations (the VM and the analyzer) will also stop supporting the tag in the near future. Now is the time to remove any uses of #resource. Please drop by the mailing list if you have any questions. Thanks for trying Dart!

Dart Editor cleans up your code for M1

Posted by Devon Carew A new Dart Editor build is available at .  Ch anges incl ude: Wondering about M1 language changes? Worried about having to update your code? Worry no more! We have a new M1 language migration wizard which'll do that work for you! Right click on your project and choose 'Clean up...'. We've implemented cleanups for catch blocks, the new getter syntax, operator equals, and library/import/source changes. Please note, the last two changes are not yet supported across all platforms. We've added the ability to write hooks into the Editor's build system. If a build.dart script exists in a project, we'll invoke it as part of the Editor's build process. This allows for custom processing of changed resources, like for templating systems, generating Dart code, or scss --> css processing. There are sample scripts available at dart/samples/buildhook1 and dart/samples/buildhook2, as well as online at  h

Dart project welcomes new external committer

Posted by Seth Ladd Welcome to our first external committer! Please help us welcome Alexander Aprelev as our first external committer to Dart . Alexander has been working on dart2js, and helping us get ready for M1. Interested in how to contribute to Dart? We're open source, and we encourage patches. Read more at our Contributing to Dart guide . Other Dart projects, like the code for and Dart + Web Components , are also open source. Lots of ways to get involved!

Ask the dart2js team

Posted by Seth Ladd This time, we're taking the Dartisans show on the road! We'll be in Denmark next week to chat with members of the dart2js team. Here's your chance to ask and vote for questions about how the Dart project compiles Dart to JavaScript. Past episodes of Dartisans have covered the Dart VM , the Dart community , and more . We look forward to hearing from you! What do you want to ask the dart2js team ?

Dart Lang meeting: All objects hashable, and more

Posted by Bob Nystrom Here's my notes from this week's Dart language meeting: Getters and implicit "abstract" Peter raised an interesting corner case with the new getter syntax and the optional "abstract" keyword. Given this:   class Foo {     get bar;   } Does it define an abstract getter "bar" whose type is Dynamic, or a field "bar" whose type is "get"? Gilad says the grammar isn't actually ambiguous here, so there's no problem. ( get bar  always defines an abstract getter because the spec disallows "get" as a type name.) We discussed whether "abstract" should be optional or simply removed. Gilad says we should leave it optional in case people want to use it for emphasis. He also wonders if there's a case we aren't thinking of (maybe like the above?) where having it would be helpful to make something clear. All objects hashable This is coming in M1. (

Easy regex to update to new getter syntax

Posted by Seth Ladd Just spotted this gem from the Dart mailing list . Community member Kevin Moore offers this bit of advice for handling the syntax change for getters : """ This saved me a lot of code spelunking, so I wanted to share. Find: (get\s+[_a-zA-Z0-9]+)(\(\))(\s+(=>|\{)) Replace: $1$3 Make sure you have regex search on. Works great in Sublime. I think the same syntax works in Textmate and likely other editors. Nice results: """ With this tip, you'll change (old code): TInput get input() => _input; to (new code): TInput get input => _input; As of 11156 the VM runs the new syntax and dart2js warns if you're NOT using it. So now is a good time to update. Thanks Kevin!

Dart Editor speed ups and fixes

Posted by Devon Carew A new Dart Editor build is available at .  Ch anges incl ude: 17 analysis issues fixed, as well as ongoing changes to support the M1 language. We added a fix to not show errors or warnings for libraries in pub's packages directory. The mark occurrences feature is now on by default. In addition, we also now warn about issues for inferred types by default. UX improvements around quick fixes. Improvements to the inline method refactoring, the extract local refactoring, and the create method refactoring. Several Dartium and command-line launching fixes. The Editor workspace location has changed. The workspace is where we store information about your open files and folders. We had stored this in a 'workspace' directory co-located with the Editor application. We now always locate it in the user's home directory. The first time you run this new build you'll have to re-open the folders you had been working on. For m

Dart's modest proposal for Mixins

Posted by Gilad Bracha (Editor's note: mixins is a work in progress, and is not slated for the M1 release. You can track the bug for this feature , and star it to be notified of changes. Please direct discussion to the Dart mailing list .) Mixins in Dart This document a minimalist proposal for introducing mixins in Dart. It is deliberately restricted in several ways, so as to minimize disruption to our existing implementations, while allowing future evolution toward a full fledged mixin implementation. The hope is that this restricted version already provides considerable value. The intent is that something very much like this would be incorporated into Dart at some time after M1. Basic Concepts If you are familiar with the academic literature on mixins you can probably skip this section. Otherwise, please do read it, as it defines important concepts and notation. In a language supporting classes and inheritance, a class implicitly defines a mixin . The mixin is usually im

Breaking Change: XMLHttpRequest becomes HttpRequest

Posted by Emily Fortuna Hello Dartisans, When is the last time you fetched XML data with XMLHttpRequest? Exactly. :) In the near future I will be landing a change that renames XMLHttpRequest (and the associated names like XMLHttpRequestException) to HttpRequest. You can review the change list , which resolves  (a highly starred request, thanks for the feedback!)  In fact, we recommend that you star the bug so you'll be notified when the change takes effect. So in the future, when you want to make an XHR request in Dart, you only need to use the shortened HttpRequest name. This is part of our continued efforts to build an easier to use interface for modern web programming.

Dart Team Updates and Notes

Posted by Seth Ladd Summary Summer vacations are wrapping up, back to work! The Dart project ramps up for the M1 release, which delivers a more stable language and implementations. Details Dart language specification: Version 0.11 is almost ready - this is pretty much the M1 version. Mixin proposal to be published. Dart libraries [core, unittest, i18n, etc]: Ability to make temporal assertions with the mocking library Work in progress on sharing the source for the dart: library implementations across VM and dart2js. Dart VM: New language features implemented: “ non-constant initializers for fields” (bug 3848), “static methods are compile-time constants” (bug 3406), “operator syntax” (bug 3767), “getter syntax” (bug 3608), “on-catch support” (bug 3757). Switched to using SSA-based optimizing compiler both on ia32 and x64. Using type propagation to eliminate assignability checks to improve checked mode speed. Added support for external and patch to enable shared cor

Follow along with a Dart port of minesweeper

Posted by Seth Ladd Dart community member and contributor Kevin Moore is building a minesweeper clone in Dart. Lucky for us, he's writing a " developer diary " to chronicle his progress. Follow along as he builds a fun simple game for mobile and desktop with the Dart project. From his first journal entry : tl;dr: I'm building a version of Minesweeper in Dart as an example of something straight-forward and fun. I hope to show how to build Dart apps and demonstrate why Dart is a great tool for building web experiences. Play it here. Check out the code on Github. Watch my blog for updates in the next few weeks. Follow his blog to learn how the game is built. We're looking forward to what Kevin makes with Dart!

Dart plugin for Eclipse is Ready for Preview

UPDATE: Eclipse plugin for Dart is now stable and ready to use. Learn more Greetings Dartisans, We're happy to announce that the Dart Editor Plugin for Eclipse is ready for preview. There are still some rough edges and we don't have feature parity with the standalone Dart Editor but there's enough in place that interested folks may want to check it out. If you want to kick the tires, add the following URL to the list of available software sites in your Eclipse installation (Window > Preferences > Install/Update > Available Software Sites): Important note: on initial install, a secondary download of the dart SDK will occur. The download should only take a few seconds and will happen in the background with progress displayed in the status line. When it's done, you'll need to restart eclipse (again). (For the curious, this second restart is required to get the S

Dart Editor adds Create Method quick fix

Posted by Devon Carew A new Dart Editor build is available at .  Ch anges incl ude: An initial implementation of a 'Create Method' quick fix. This will create a method definition to satisfy a reference to a non-existent method. You can access this functionality through the ctrl/command-1 keystroke; currently only top-level functions are supported. Several analysis fixes and various updates to our analysis code for M1 language support. We now include optional parameters in completion proposals. There is a new Breakpoints view to view your debugger breakpoints. Enhancements to our open folder code to better support opening very large applications. Fixes to the Apps view and enhancements to our Welcome page. As always, view the  changelog  for the full list of changes, and to get started  with the  Editor  see our  tutorial .

9 ways to follow along with Dart

Posted by Seth Ladd "How do I keep up with all the news and info about Dart?" was a great question posted to our mailing list . This post summarizes how you, the busy developer, can keep up with Dart. Subscribe to for postings on upcoming language changes, announcements, and news. Circle +Dart on Google+ for news and community projects. Follow #dartlang on Twitter and #dartlang on G+ to get an overview of all Dart activity. Ask and answer questions about Dart on Stack Overflow . Community news is posted to . Blog posts about Dart are collected at . Star issues at to get email updates. Try searching for M1 milestone issues. Watch the Dartisans show (video and podcast) for interviews and discussions. If you like discussing language design, join the Dart discussion mailing list . Hope that helps!