Skip to main content

Posts

Showing posts from January, 2013

Breaking Change: Iterable.mappedBy is now Iterable.map, List.skip/take return Iterables

mappedBy(), we hardly knew ye!! Florian Loitsch  tells us the reason   for the name change to  map()   :  We are reverting the name-change to 'map'. I got a lot of feedback, and the name is clearly not working for most of you. We are therefore reverting back to "map". In order to avoid mistakes we will also make the return-type (and dynamic type) of List.map be an Iterable, and not a List. This will, hopefully, make it more clear that the result is a lazy wrapper instead of an eager evaluation. For consistency we changed the return-type of List.skip and List.take to be an Iterable too. We are going to keep the mappedBy method in the implementation (next to "map") for several weeks, so you have the time to migrate. The List.skip/take methods will furthermore continue to return Lists (even though their return type is "Iterable"). When we finish the transition "mappedBy" will go away, and skip/take will return Iterables

New Iterable API Can Filter, Transform, and More

Dart engineer Florian Loitsch has published a new article on Dart M3's Iterable interface . Available today as a preview, you can use Iterable to filter, transform, chain, and more. Many of the collection methods have moved up to Iterable. Florian writes: Iterable was extended with many Iterable-returning methods. These are lazy methods in that they only wrap the original instance. They do not immediately perform any work. Instead, it is the iterators of the wrapping objects that do the actual work. As a consequence it is possible to modify the original Iterable (adding new elements, or deleting them) and the wrapping iterable will see the changes. (Of course, it is still not allowed to change an iterable while an iteration is in progress.) New methods include methods to skip the first elements ( skip()  and  skipWhile() ), or to ignore remaining elements ( take()  and  takeWhile() ). We furthermore moved the Collection methods  map()  and  filter()  to Iterable and rena

New Dart Editor Build With Expanded Exception Debugging and Autocompletion in Import Statements

Dart Editor has new build. Eric Clayberg  fills us in on the details : A new Dart Editor build is available at  www.dartlang.org/editor .  Ch ang es include: Added a new launch configuration for Chrome packaged apps. Add the ability to specify the break-on-exceptions behavior in the debugger (break on all exceptions, uncaught, or no breaking). The editor now supports autocompletion in import statements! Improved labeling on empty Dart search results More navigation menu enhancements Fix for resolving package: imports in dart scripts in HTML files Various analysis and editor fixes Breaking Change List: Window.requestLayoutFrame is being renamed to window.setImmediate- it's functionally equivalent. The API is essentially a microtask API for executing callbacks after the current stack has unwound but before the next event and the rename is intended to be clearer about that. We've also improved the underlying behavior on IE (to use window.setImmediate) which

Important New Dart Editor Build with Support for New Dart Libraries

Dart Editor has a very significant new build that integrates support for many of the new v2 libraries. Eric Clayberg fills us in on the details  and warns that this build is likely to break existing code : A new Dart Editor build is available at  www.dartlang.org/editor .  Ch anges include: Mixin support in code completion and refactoring. Revised navigation menu items on editor context menu. Items only appear when applicable New “Find all” item to search for all declarations of a method In the command-line debugger, selecting a running isolate will display all the libraries for that isolate, and all the top-level variables for those libraries.  For both debuggers, break-on-exceptions is now enabled by default (Issue 4765). Added a new wizard for creating Chrome apps. Thanks to Adam Singer for the template for this wizard! Added a new wizard for creating a web-ui application. Thanks to Chris Buckett for the CL to make this happen! Editor samples and wizards upda

Breaking Change: the Hashable Class to be Removed

The Hashable class is being removed. William Hesse  tells us why :  Since everything is hashable, there is no need for a Hashable class.  We've kept a class with that name alive, so that code using it wouldn't break, but now it's time to let it go. As always, we invite you to join our  Dart mailing list , ask questions on  Stack Overflow , or file feature requests on  dartbug.com

Breaking Change in dart:io Path() Class Makes it Easier to Deal with Windows Paths

Some changes are coming to the dart.io Path class constructor that will help make Windows paths platform agnostic.  William Hesse  gives us the details :  I have finally changed the new Path(String path) constructor to automatically convert Windows paths into platform-independent paths, the way that new Path.fromNative(String path) does now.  I found no cases where code needed to create a path without doing this conversion on the Windows platform, so we thought we should make it the default.  It is fine if this conversion is done more than once to a path, since it has no effect the second time. The reverse of this conversion is done by the toNativePath() method of Path, which returns a string which follows the conventions of the platform.  On Windows, slashes are changed back to backslashes, an initial slash is removed from a drive letter, if present, and a network share starting with two backslashes has them restored. The previous functionality of new Path() has been ren

First Look at new Dart Libraries

The Dart libraries are implementing a common model for processing a stream of events, and you can try the new libraries now with a preview release of Dart Editor . Developers consistently told us they wanted a more unified method for dealing with asynchronous events. The new Streams API from the dart:async library delivers on the vision of a builtin way to listen for, transform, and emit a sequence of events. Beautiful streams. There are numerous changes in the new Dart libraries, above and beyond just Streams. Here is a look at what's new, with some tips for migration. Note: this list is not comprehensive.  You can explore the API docs to learn more about these new libraries. Core library Iterable interface is changed. Now uses "bool moveNext()" and "E get current" to advance and read the current value. Iterable interface is greatly extended. Collection methods moved to Iterable, e.g. any and contains. ‘map’ has been renamed to ‘mappe

New DOM Event Streams API makes it Easier to Listen to and Capture Events

A new API is on the way for dealing with DOM events in Dart. Google engineer Peter Bois   gives us the details : One of our goals for exposing DOM events in Dart is to have them follow the 'best practices' for events- particularly events which are exposed in places such as your application data model. The current plan is that DOM events would be exposed as: class Element {   static const HtmlStreamProvider<MouseEvent> clickEvent =      const HtmlStreamProvider<MouseEvent> ('click');   Stream<MouseEvent> get onClick => clickEvent.forTarget(this); } The HtmlStreamProvider class is: class HtmlStreamProvider<T extends Event> {   const HtmlStreamProvider(String eventType);   Stream<T> forTarget(EventTarget e, {bool useCapture: false}) } There's basically two parts-  The static declaration of the event as an HtmlStreamProvider which provides a Stream for a DOM event on a specific target. This is only real

BIG BREAKING CHANGE: dart.js Bootstrap File is Moving to Pub

dart.js file is moving to Pub and can be found in the new  browser  package. The familiar link to dart.js from your html files, should be replaced by declaring a dependency to this package, or by hosting a local file .  This is a far reaching change that will impact all browser based Dart applications ; Dartisans are urged to follow the   advice provided by Vijay Menon :  FYI: We are moving the bootstrap file dart.js to pub.  Please update any links to dart.js from your html files accordingly.   We will delete the old copy of dart.js in our repository in a couple weeks. The dart.js file is used in Dart browser apps to check for native Dart support and either (a) bootstrap Dartium or (b) load compiled JS instead.  Previously, we've recommended that you add a script tag pointing the version of dart.js in our repository.  This doesn't work offline and also results in slower startup (see  dartbug.com/6723 ). Instead, we now recommend that you ins

Notes from January 7 language meeting

Dart engineer  Bob Nystrom  has  posted the notes  from the January 7th language design meeting. He writes: Here's my notes from this week's meeting: call() versus operator() Gilad brought up the perennial discussion of how classes that emulate functions should define that operation: as a method named call() or using an operator syntax. Lars: What are problems with making it an operator? Gilad: At this point I think we could. It's an incompatible change, but not a big deal. Configuration-specific code Gilad has a rough proposal he's working on for this. Method cascade grammar [Bob: I think the Dart implementations and spec are out of sync regarding how they handle precedence of method cascades in particular with respect to the ternary operator.] Gilad: The grammar for cascades makes sense from perspective of someone looking at the grammar, but not as much for someone trying to program using them. Kasper: There are a couple of

New Dart Editor Build with Expanded Windows and Chrome Apps Support

Dart Editor has new build. Eric Clayberg   fills us in on the details : A new Dart Editor build is available at  www.dartlang.org/editor .  Ch anges include: Windows love! You can now debug command-line applications from the editor! This was a long-awaited feature. The command-line dart_analyzer tool is now available in the Windows SDK (dart-sdk/bin/dart_analyzer. bat). Various Windows bug fixes and UX cleanup. Several changes in support of building Chrome Apps: Add a setting to allow the user to pass custom flags to dart2js (like --disallow-unsafe-eval). To configure this, right-click on a project and choose 'Properties'. Added a manifest.json editor. Improved support for Dart code in html files Syntax highlighting Analysis for inline scripts. Package version information is now shown in the Files View The Problems view can now optionally just show problems for the currently selected project. Improved css and yaml editors Filter log entries dur

Dart Lands First Set of Library v2 Changes

The first big set of "Dart library v2" changes landed in the bleeding_edge branch today, which means it's time to investigate changes required to your code and pub packages. Further details about the changes, along with tips for updating, are forthcoming. For now, here's what you, our intrepid Dart developers, need to know. The biggest changes are to async and collections Everyone's first question: so, what's new? Until we publish a more comprehensive list of changes, here's a short, incomplete list to wet your whistle: The new dart:async library now contains Future, Timer, and Streams. The Future class changed quite a bit. For example, chain and transform are now simply then . The new dart:collection library has more functionality beyond the basics found in dart:core. The Iterator class changed, with new methods moveNext() and current . Many new operations, and some old ones, work with Iterable. List gets two new named constructors: List.fi