Skip to main content

Posts

Showing posts from October, 2012

Breaking Change: More methods turn to getters

The Dart libraries continue to evolve, with a new round of methods turning into getters. Florian Loitsch posted this notice to the Dart mailing list : As of r14094 Map.getKeys() has been changed to Map.keys, Map.getValues() to Map.values, and Match.start()/end()/groupCount() have been made getters. Map: https://codereview.chromium.org/11267018/diff/7001/lib/core/map.dart Match: https://codereview.chromium.org/11266050/diff/5001/lib/core/regexp.dart Examples: myMap.getKeys() is now myMap.keys. myRegExp.firstMatch("foo").start() is now myRegExp.firstMatch("foo").start. As always, the Dart encourages you to join the conversation on the  Dart mailing list , ask questions on  Stack Overflow , and file feature requests and bugs on  dartbug.com .
Read more

3 New Code Cleanups from Dart Editor

Dart Editor has added three new code clean ups to its growing list: Replace some methods with getters Renaming some types Removing abstract keyword for methods without a body Other new features include: New “Organize Imports” action New migration Clean Ups -  replacing some methods with getters; renaming some types; removing “abstract” keyword for methods without body. Enhanced “Extract Method” refactoring to allow changing parameter types In the command-line debugger, we added the ability to pause a running isolate. Improved how we display null value objects in the debugger. Updated samples based on language and pub changes Fixes for inline method and local Fixes for syntax highlighting Fix to automatically refresh out-of-sync resources Fixes to better handle package symlinks in search and the files view. And as always, view the changelog for the full list of changes, and to get started with the Editor see our tutorial. The editor auto-updates now, s
Read more

Use Web Components Today with Dart

In a new article posted to the Dart homepage , engineer Siggi Cherem shows you how to build with Web Components using Dart. Web Components are ushering in the "declarative renaissance" for modern web app development, providing encapsulation of structure, styles, and behavior. "But it'll be years before I can use Web Components!?!" you exclaim. Not true! Thanks to Dart you can compile Web Components into today's HTML and JavaScript. In the article , Siggi writes: Dart web components provide templates, data binding, and encapsulation, to help you write web applications at scale. An early version is available in the  dart-web-components project .   Many UI frameworks exist for writing web apps in JavaScript—for example  Backbone.js ,  Ember.js , and  AngularJS . Recently, the web community has been pushing to include some of the common ideas of these frameworks directly into the browser platform. As a result, browsers have added features like  sh
Read more

3 Tips for Benchmarking Dart Applications

John McCutchan shares three tips for  benchmarking your Dart application . Benchmarking is the act of measuring how much memory or CPU time your application takes to execute. The article focuses on CPU benchmarking and explains how to correctly set up a Dart benchmark. Make your code faster (Photo by Slooby ) The article covers these three important steps when benchmarking your Dart application: Perform a warm-up before measuring code performance. Ensure the code does not raise any errors when run in checked mode. Run your benchmark in production mode with debugging disabled. As always, the Dart team is interested in your feedback. Please join the Dart mailing list , ask questions on Stack Overflow , and file feature and bugs on dartbug.com .
Read more

Coreimpl finally waves goodbye, and more breaking changes

Looks like the work on Dart libraries is really picking up. It was announced that dart:coreimpl is being removed, and some methods on numbers are now more simple getters. dart:coreimpl will be removed Anders Johnsen wrote to the Dart mailing list: I've already started moving implementation classes out of dart:coreimpl and making them a private member of dart:core. I'll continue to move the rest over the week.  Once the move is done, we intent to re-expose some of the same functionality in other libraries.  If you are currently using any of the classes in dart:coreimpl, you can make a local copy for your program to use, and file a bug for a feature request in the library area on http://dartbug.com/new. isNaN and friends are now getters Florian Loitsch also wrote: Starting with r13974, you'll find that isNaN, isInfinite, isEven, isOdd, isNegative on numbers are now getters. In the same CL I updated the fixnum pkg where I also change isZero, isMaxVal
Read more

Dart syntax changes landing soon, update your code

With the release of M1, the Dart team is preparing to remove some of the old syntax that was deprecated. Kasper Lund , engineer on Dart, writes about the upcoming changes and how you can migrate your code. Note : Dart Editor has a nice Clean Up feature that can automatically update your code for many situations. Kasper writes: We're ready to start removing the syntax we deprecated in M1. The annoying thing is that you may have to update your code. The good thing is that the replacement syntax is already in place and you can use it today. Here's a brief list of the deprecated syntax that we will be removing shortly. Remove old getter syntax We're getting rid of the old getter syntax so going forward you will no longer be allowed to have parentheses after your getters. If you use:    get length() => 42; you'll need to change that to:    get length => 42; Remove member/constructor conflict support Your nam
Read more

Build HTML5 games with Dart

Learn how to build HTML5 games with Dart in this video from Kevin Moore . Kevin walks you through his open-source  Pop Pop Win! game. Kevin used HTML5 canvas, Web Audio API, and more. He also uses his BOT pub package , which is a collection "of (mostly) general libraries to make working with Dart more productive." You can see all the code to Pop Pop Win! on Github . The game even works on desktop and mobile!
Read more

Dart's JavaScript compiler's optimization techniques

Dart engineer Florian Loitsch presented " JavaScript as a compilation target - Making it fast " at JSConf.EU. The video is now up: Florian discusses how dart2js, Dart's compiler to JavaScript, works and goes over some of its features. For example, dart2js performs "tree shaking", a technique to eliminate dead code from the compiled output code. Enjoy!
Read more

Update your optional params syntax now, Dart VM and dart2js

Régis Crelier, engineer on the Dart team, posted the notice that both the Dart VM and dart2js will start to enforce the new optional parameter rules. From his mail : On Monday, we will submit a change to bleeding-edge enforcing the new optional parameter syntax and semantics, as described in the spec. Until now, both the vm and dart2js have been running in a backward compatible mode, where named arguments could still be passed to optional positional formal parameters, which is not allowed under the new rules.  If you want to check before Monday whether your code is going to break, please use the flag --reject_named_argument_as_positional for both the vm and dart2js. To learn more about these changes, read about how  named optional params and positional optional params are specified differently . As always, we encourage you to join the Dart mailing list , ask questions on Stack Overflow , and file feature requests and bugs at dartbug.com . Thanks!
Read more

More Dart libraries ready for use, thanks to Pub

One of the big features of the Dart M1 release is our package manager, pub . You can discover, install, and manage 3rd party Dart libraries with pub. Pub is a command-line app with Dart Editor integration, as well as a hosting service for Dart packages. We've been uploading select packages, but soon you'll be able to upload your own packages to pub. I sat down with two of the pub engineers, Bob Nystrom and Nathan Weizenbaum , to learn more about pub and what's on the roadmap. Q) What exactly is a package? Bob: It’s a directory containing Dart code and all of the other stuff that goes along with it: tests, docs, examples, resources. It also has metadata that describes the package and its dependencies–the other packages it relies on. Nathan: It’s important to note that Dart applications can be packages even if they don’t export any libraries and they’re not going to be re-used anywhere. As long as it declares its dependencies in a pubspec, pub considers it a pa
Read more

Speed Matters, says Dart co-founder Lars Bak

Lars Bak, engineer on HotSpot, V8, and now co-founder of Dart, presents a bit of history that lead to Dart and why performance is key for the web. Lars Bak from Stange Loop conference The video and slides from his presentation "Pushing the Limits of Web Browsers" from Strange Loop in September 2012 are now available. In the presentation, he covers lessons learned from building Java VMs, Smalltalk VMs, JavaScript engines, and how those lessons impacted the design of Dart. Slide from Strange Loop presentation
Read more

Celebrating Dart’s birthday with the first release of the Dart SDK

A year ago we released a technology preview of Dart , a project that includes a modern language, libraries and tools for building complex web applications. Today, after plowing through thousands of bug reports and feature requests from the web community, a new, more stable and comprehensive version of Dart is now available and ready to use. With this version of the Dart SDK, we’ve made several improvements and added many features: A faster Dart Virtual Machine that on some Octane tests outperforms even V8 . A new Dart to JavaScript translator that generates fast and compact output. An HTML library that works transparently on modern browsers. A library to interoperate with JavaScript code. An easy to use editor . Pub , a new package manager Dartium , a Chromium build with native Dart support. A server-side I/O library . A language specification describing the Dart semantics, including new features . Over the following months, we will continue to
Read more

Notes from October 8 language design meeting

Dart engineer Bob Nystrom has posted the notes from the October 8 language design meeting. He writes: Making throw an expression Lars wondered what the motivation behind adding to the spec was. My recollection was that it was so you could use it in lambda-body methods:   class ImmutableList implements List {     void add(item) => throw new NotSupportedException();   } Kasper looked at the code to parse throw as an expression and found out it's hideous because of rethrows. Lars wants to know more about the impact of this. How tightly does it bind when embedded in an expression? Do we want to allow it in a ternary operator? He wants to know more about the original motivation behind this. Mixins Lars suggested we could do the general purpose solution and allow constructors but he would prefer something stepwise where we don't allow constructors at first. You could still have fields but they would need initializers at the declaration. We can get
Read more

Show type hierarchy in-line with new Dart Editor

A new Dart Editor build is  available at  www.dartlang.org/editor . Changes include: We now support showing an in-line type hierarchy view (Command-T on the Mac and Ctrl-T for Linux and Windows). We have a new Quick Fix to import or create a type when it is used as invocation target. General work to the Eclipse plugins including: cleaning up some spurious menu contributions, adding menu items to invoke dart2js and dartdoc and adding the ability to open Dart files in non-Dart projects Several code completion enhancements, including: support for both named and optional parameters showing proposals for function parameter names following unary-? improved proposals for cascades Web components support is now enabled on Dartium launches by default. The .project metadata file has been moved out of the user's source directory. The html and css editors now use a default indent of two spaces. 6 analysis fixes, as well as fixes to the debugger, Outline view, feed
Read more

Debunking Dart Myths

Today, Seth Ladd , Developer Advocate for Dart, was interviewed by Addy Osmani , Developer Programs Engineer for Chrome and Tools. Addy asked the tough questions that many web developers have about Dart, and Seth debunked (you might say busted) some of the most common myths. Watch the video to see questions answered like "Is Dart out to replace JavaScript?" (spoiler: nope!), "Does Dart work with JavaScript code?" (spoiler: you bet!), and "Isn't Dart's compiled output to JavaScript really big?" (spoiler: not any more!) If reading is more your thing, Seth also wrote up 9 Dart myths debunked . As always, the Dart team wants to hear what you have to say. Join the discussion in the Dart mailing list , ask questions on Stack Overflow , or file bugs and feature requests on dartbug.com . Thanks for trying Dart!
Read more

The Dart Team Welcomes TypeScript

It must be something in the water. Gilad Bracha and Lars Bak announced Dart in Aarhus, Denmark about a year ago as a “new programming language for structured web programming”. Yesterday, Anders Hejlsberg, once again in Aarhus, Denmark, announced Microsoft’s new programming language, TypeScript, “a language for application-scale JavaScript development”. Obviously, there’s something about the water in Aarhus that causes language designers to want to tackle the problem of large scale web development. Perhaps that’s why we chose to put the dart2js team in Aarhus full time! Now that we’ve had a chance to take a look at TypeScript, the Dart team would like to welcome the TypeScript team to the neighborhood. If you already have a large JavaScript codebase, and if you already use Visual Studio, we think that TypeScript could be a great addition to your project. A year ago, JavaScript programmers would frequently ask us why we needed a new programming language for the web. We argued that
Read more

Dart Editor now analyzes as you type

A new Dart Editor build is  available at  www.dartlang.org/editor . Changes include: We now have analysis as you type! You're now alerted about errors as you type without first having to save the file. Debugger expression evaluation - when paused at a breakpoint in Dartium it's now possible to evaluate expressions. You can access this feature from the 'Show Expressions' toolbar button in the Debugger view. This is a Dartium only feature currently; support for the command-line debugger is forthcoming. We have two new quick fixes; one for creating a class and one for creating a constructor. Fixes for debugging command-line and Dartium apps when used with Pub and the packages directory. Tweaks to the @deprecated and @override presentation. And fixes to the cleanups, to our auto-update, for a debugger crash with Dartium, as well as 11 analysis fixes. In addition, if you're running MacOS 10.8 (Mountain Lion), it will complain that our 64-bit d
Read more