Wednesday, June 19, 2013

Release Notes for Dart's Beta Release

Today's release of the Dart SDK and Editor is the first beta release, and contains performance and productivity improvements across the platform. This latest release helps Dart developers automate code evolution, produce smaller JavaScript code and deploy Dart web apps.

The major additions and changes to the platform include:



  • dart2js
    • Added support for dart:typed_data
    • Improved type inferrer by using union types and keeping track of side effects
    • Implemented sharing of code mixed into multiple classes
    • More coverage for handling of generic type
    • Performance improvements
      • 20% faster on Richards, 10% faster on DeltaBlue, 8% faster on Tracer
    • Significant progress on mirrors support (work in progress)
  • Dart VM
    • DeltaBlue: 40% faster than M4
    • Tracer: 33% faster than M4
    • Full SIMD acceleration
    • Reduced initial snapshot size
      • improves startup time for new isolates
    • Improved stability of debugging experience
  • Editor
    • A new 20% faster Analyzer in Editor and SDK.
      • Remove old analyzer.
    • More quick fixes and refactorings in Editor.
    • Code Folding has returned with the new ability to collapse classes and local functions.
    • Mark Occurrences is back.
    • New Pub Deploy command.
    • Many Code Completion enhancements
      • Proposal filtering now accepts camelCase input (e.g., type 'i' then 'E' to filter out everything except isEmpty).
      • Unused optional parameters are deleted automatically after template editing is done.
      • Requesting completion in an empty argument list will include an option to insert the argument template.
      • The seed is now case-insensitive (e.g., map.isemp+Ctrl-Space -> map.isEmpty).
  • Greatly improved WebGL performance in Dartium because of move to dart:typed_data library for typed arrays.
  • Libraries
    • dart:async
      • Stream bugfixing (one breaking change: disallow re-subscribing to cancelled stream)
    • dart:core
      • Allow Pattern (like String and RegExp) in more places.
    • dart:uri
      • Functionality moved to dart:core, API improved, stable.
  • dart:crypto
    • Not essential to have as a dart: library at this point. Moved to a pub package.
  • dart:io
    • Added IPv6 support
    • Improved speed and stability of HTTP and Web Sockets. HTTP handing is now more than 50% faster
    • Better support for processing HTTP bodies
    • Improved HTTP authentication and proxy support
  • pub:
    • New backtracking version solver, SDK version constraints
    • Add offline mode
    • Initial version of pub deploy
  • html:
    • New dart:mdv_observe library
    • Typed_data
  • dartium: devtools improvements
    • Repl-style behavior including creating new Dart objects from the console
    • Mouse over of Dart fields and getters now displays their values
    • Fewer crashes
  • Web UI
    • New polymer branch, implementing Web UI with Polymer polyfills (work in progress)

    You can download the latest version of Dart Editor, including everything you need for Dart development, from dartlang.org. We look forward to your feedback!

    Notes from the June 10 Dart language design meeting

    The incomporable Bob Nystrom fills us in on the language design discussions taking place amongst Dart engineers. Here are his notes from the June 10th language meeting:

    Here's my notes from this week's (short) meeting:

    Name collisions with dart: imports

    [A customer recently ran into an issue where a new type appeared in dart:html whose name collided with a name they were importing from elsewhere. This broke their app.]

    Gilad brought up this issue. Pete's suggestion is if there's a collision between a "dart:" import and another library, the other library wins. That way, we can add stuff to "dart:" libraries without breaking people. I explained some more details here.

    Lars asked if there are any negative consequences from that suggestion and when it needs to be fixed. Kasper suggested we start making it a warning [instead of an error?] now.

    Ivan asked how JS handles this. Kasper said DOM names are usually higher up on the prototype chain so you get similar shadowing behavior there to what we're suggesting for Dart now.

    Type guards

    Folks in Aarhus had a discussion about type guards. When you do "if (x is Foo)" in the then branch can you statically tell x is of type Foo? The conclusion they came to is that if locals aren't final, the rules are so complicated it's not worth doing. With mutable locals, you get lots of problems with closures that assign to that local.

    For finals, though, they are fine with inferring the type here as long as it doesn't make the rules too weird.

    I asked about parameters which are non-final by default. Kasper says you can mark those final.

    Cheers!

    As always, view the changelog for the full list of changes, and to get started with the Editor see our tutorial.

    Wednesday, June 12, 2013

    Angular.js announces port for Dart

    The Angular team recently announced a Dart port of the popular Angular.js framework.

    Large parts of Angular functionalitycomponents like $compiler and $scope, basic directives like ngBind and ngRepeathave already been ported over to Dart and can be used today.  Other critical Angular parts like Dependency Injection and Routes are being ported now. Karma, the Angular test runner, already works with Dart.

    Angular team members Brad Green and Igor Minar provide details in the video from the AngularJS meetup this week. The Dart-specific discussion begins at the 40 minute mark.





    Tuesday, June 11, 2013

    Notes From the June 4 Dart Language Design Meeting

    The incomporable Bob Nystrom fills us in on the language design discussions taking place amongst Dart engineers. Here are his notes from the June 4th language meeting:

    Here's my notes. As usual all mistakes are my own:

    are boxed doubles identical?

    There is a bug where doubles with the same value may return false for identical() because they have been boxed to different objects.

    Lars said it's been discussed. For doubles, identical() should return true based on value. We don't want the language spec to have to mention boxing so that the VM is free to optimize how it wants.

    Gilad asked if NaN is identical to NaN?

    Lars says yes. It's identical but not equal. Gilad will fix the spec.

    change uninitialized field error to warning?

    Uninitialized final fields are currently an error in the language. Kasper suggests making it a warning. It seems in line with other stuff in language. It's easy to associate some value with an uninitialized final.

    Gilad says we can do this and asked why Kasper ran into it. Kasper saw some bugs where implementations behaved differently in some related corner cases.

    Lars doesn't have a problem with it.

    const instance variables

    Gilad's view is that they should work like statics except for scoping. Apparently, though, it's complicating the VM implementation of instance metadata. Three solutions:

    1. No const instance fields.
    2. Metadata is statically scoped.
    3. Try to do it correctly.

    Lars likes 1. I say 1 simplifies things for users. Right now, people get confused with static final const etc. Gilad is OK with 1.

    I asked if the syntax would be "static const" or just "const"? Users get confused when having to do "static" with constants.

    Lars says they are confused because they don't understand the system. Requiring "static" will help them understand what's going on.

    what liberties can editor take with type system

    [I didn't have a lot of context here, so I'm fuzzy on the details.]

    Dan Rubel asked how flexible the analyzer can be with the Dart type system and how it can extend it.

    Gilad is OK with things like type inference for auto-complete. What other things should we allow?

    Lars says step one is to do exactly what the spec says. Going beyond that and helping user with refactoring and stuff is great. Using it for warnings gets strange. If you go from the Editor to command line, you would get different warnings.

    Dan's concern is more about false positives. We should look at code and see if they use constructs like guarded type promotion.

    Lars says if users are using these constructs a lot, we should change the language to support them. If you want to have a type guard match thing we should have a different construct. But for now, the analyzer should go with the current spec.

    Kasper says we have to be careful if we report fewer warnings because users will get used to that and then get confused if other tools follow the spec more closely and have more warnings.

    stack traces

    Lars had lots of discussions back and forth with some internal Dart users. One issue is about catching exceptions and capturing stack traces and how its painful for some. Lars is OK if severe errors like noSuchMethod automatically get a stack trace.

    Kasper says that would mean two ways to access stack traces. I note that with async, it's three. Lars says Florian has some idea of a constant flag to enable/disable stack trace capturing.

    Gilad asks if the spec would have to lay out which errors get stack traces and which don't? Lars says they'll come up with a proposal.

    Cheers!

    As always, view the changelog for the full list of changes, and to get started with the Editor see our tutorial.

    Tuesday, June 4, 2013

    Faster is Better: New Article on Numeric Computation in Dart

    "Performance matters to everyone", says Dart engineer John McCutchan. His new article, "Numeric Computation", tells you how to get "50-100% speed improvements" with just a few simple rules.

    John covers integers, doubles, boxing, typed lists, and more. He also covers various considerations for Dart code that is compiled to JavaScript.

    Boxing requires a memory allocation and a store. Unboxing requires a load.
    If you write code that works with numbers, and that's pretty much everyone, you should read this article. Please join us for discussion in our Dartisans community. Thanks for trying Dart!