Skip to main content

Posts

Showing posts from April, 2013

New Dart Editor Build With Enhanced Refactoring Support

A new Dart Editor build is available at www.dartlang.org/editor. Eric Clayberg fills us in on the changes:
Semantic highlighting enabled for new analysis engine.New “Convert Method to Getter” and “Convert Getter to Method” refactorings.New “Create Class” and “Create part” quick fixes.New “Import Library” quick fixes.Multiple hover text improvements.Fixed several debugger bugs related to not being able to hit breakpoints.Additional warnings and errors enabled in new analysis engine.Many general improvements and fixes to new analysis engine.         Breaking Change List: MirrorSystem.libraries uses Uri instead of library names.LibraryMirror.url changed to LibraryMirror.uri.Rename dart:typeddata to dart:typed_data. As always,view the changelog for the full list of changes, and to get started with the Editor see our tutorial.

Notes from the April 22 Dart Language Design Meeting

Once again, the ever-helpful Bob Nystrom fills us in on the language design discussions taking place amongst Dart engineers. Here are his notes from the April 22 language meeting:
elvis operator / safe navigation operator
Lars is fine with the idea of adding some syntactic sugar like this if it helps real users. Kasper thinks we should wait until after 1.0 to look into it since we'll need analyzer support, editor support, tests, etc.
Lars is worried about a safe navigation operator because he thinks it would be strange if people started using it everywhere.
The current plan is to wait until after 1.0 and then discuss it again.
unique library names
Kasper has an idea to ensure that library names are unique when packages are published on pub. He wants to make it easy for users to give unique names, so the easy idea is to use the package name as a prefix.
I mentioned that validating this at publish is the least user-friendly time to do this. Something in the editor would be less painful. I …

New Dart Editor Build with Run Last Launch Option

A new Dart Editor build is available at www.dartlang.org/editor. Eric Clayberg fills us in on the changes: Run > Always Run Last Launch menu option when enabled will always run the last launch unless user chooses another launch explicitly. “Refactor” top-level menuSupport for inlining getters and setters.“Rename...” proposal in Quick Assist (Cmd+1)Use import prefix for return type in 'Extract Method' refactoring.Several Quick fixes.Several debugger fixes.Additional warnings and errors enabled in new analysis engine.Many general improvements and fixes to new analysis engine. Breaking Change List: Invocation use Symbol instead of String for names.Invocation.invokeOn was moved to InstanceMirror.delegate in dart:mirrors. As always,view the changelog for the full list of changes, and to get started with the Editor see our tutorial.

Pub's New Constraint Solver

TL;DR: Pub now has a new constraint solver that will pick versions of packages that work with your SDK. No more "doesn't work with your SDK" errors. This should appear in your life in the next SDK build.

Pub's job is to look at your dependencies and select the best versions for them. Given things like  shared dependencies, that's surprisingly hard. NP-complete, in fact.
So our initial version solver for pub was a very simple one. It would always terminate in a reliable amount of time, but that meant it could fail to find a solution to your package's constraints even when a solution existed.
One area where that's painfully obvious is SDK constraints. Because the Dart SDK itself is changing rapidly, any package likely only works with one or a couple of versions of the SDK. A while back, we added support so you could note which versions of the SDK your package supports.
Unfortunately, pub's solver was too simple to do take advantage of that. Instead, it woul…

New Quick Videos on Dart's Classes, Exceptions, and More

More Dart Tips videos are available, covering topics such as classes, getters and setters, exceptions, and more.


Get caught up and watch the following episodes now: Functions are fun, pt 2Control flow statementsExceptionsClasses: setters and gettersClasses: constructors If you have questions or comments about the videos, or Dart in general, please join our mailing list. As we say on Dart Tips, stay sharp!

Goodbye InvocationMirror, Hello Invocation and Symbol

TL;DR: We added a class Symbol to dart:core, renamed the class InvocationMirror to Invocation (keeping it in dart:core), and moved Invoke.invokeOn to InstanceMirror.delegate (moving this functionality from dart:core to dart:mirrors). Furthermore, Function.apply and InstanceMirror.invoke take a Map<Symbol,dynamic> to represent named arguments. Finally, dart:mirror uses Symbol instead of String to represent names.





Previously, InvocationMirror looked like this:
abstract class InvocationMirror {  String get memberName;  List get positionalArguments;  Map<String, dynamic> get namedArguments;  bool get isMethod;  bool get isGetter;  bool get isSetter;  bool get isAccessor => isGetter || isSetter;  invokeOn(Object receiver); }
This creates problems when minifying, both when compiling to JavaScript and when minifying Dart code.  For example, a meth

List of Last Minute M4 Breaking Changes

The M4 release saw the Core, Async, and Collection libraries stabilize. Dan Grove has compiled a list of thelast minute breaking changes:

The separator argument in Iterable.join defaults to “” (instead of `null`). All DateTime constants are non-abbreviated. Also changed DAYS_IN_WEEK to DAYS_PER_WEEK. Removed deprecated classes and methods CollectionSink Stream.pipeInto Iterable/Stream . max/min Collection (List, Set and Queue now extend Iterable directly) Datetime.</<=/>/>= IOSink.writeStream (renamed to IOSink.addStream) IOSink.writeBytes (renamed to IOSink.add) StreamSink (renamed to EventSink) Iterable.reduce/Stream.reduce introduced that does not require an initial value. List range functions were refactored: List.getRange takes an endIndex argument and returns an Iterable. List.setRange takes an endIndex and an iterable (plus an optional skipCount). List.removeRange takes an endIndex. List.insertRange got removed. List.replaceRange was added.