Saturday, September 29, 2012

Breaking Change: Hashable interface is removed

Lasse Nielson writes to the Dart mailing list:

Now that we have implemented hashCode on Object, we no longer need the Hashable interface for anything.
We have removed all references to Hashable in the SDK classes[1], and will be removing the Hashable interface
itself later - no earlier than in two weeks, but at some later point it will be removed without further warning.

The Hashable interface is still there, so classes that implement Hashable won't break immediately.
Code that *tests* whether an object is Hashable will probably begin failing immediately! For example String is no longer Hashable.

Two Dart M1 language changes converged to make this breaking change possible. First, explicit interfaces have been removed. Dart classes expose an implicit interface, so no need for explicit interface declarations. Second, Object now implements hashCode, so all objects explicitly are hashable.

As always, you can join the discussion at that Dart mailing list, or ask questions on Stack Overflow. Thanks for trying Dart!