Thursday, September 13, 2012

BREAKING CHANGES: Duration, RegExp, Uri.fromComponents

Kasper Lund has been making good use of the new named optional parameters syntax, a new Dart M1 language feature. He writes to the mailing list:

Over the last few days, I've changed the constructors for Duration,
RegExp, and Uri.fromComponents to insist on getting their optional
parameters passed by name. This is possible using the new named
optional parameter syntax where the formal parameters are enclosed in
{ }:

  class RegExp ... {
    const RegExp(String pattern, {bool multiLine, bool ignoreCase});

It isn't possible to pass these optional parameters positionally
anymore; you have to pass them by name or leave them out:

  const RegExp("foo")
  const RegExp("foo", multiLine: true)
  const RegExp("foo", ignoreCase: false)
  const RegExp("foo", multiLine: true, ignoreCase: false)

The following constructor invocation that used to be legal are now illegal:

  const RegExp("foo", true)
  const RegExp("foo", true, false)