dart_immutable becomes persistent (and a poll)

36 views
Skip to first unread message

Paul Brauner

unread,
Nov 14, 2012, 2:50:23 PM11/14/12
to General Dart Discussion
Hello,

The library hosted at http://code.google.com/p/dart-immutable/ used to be called 'dart_immutable/dart_immutable.dart'. It is now called 'persistent/persistent.dart'. Which means that if you were depending on it (I seriously doubt anyone's using it, but still :)) you now need to change dart_immutable into persistent in you pub dependencies and you imports in your .dart files. Moreover, the class ImmutableMap has been renamed into PersistentMap.

I'm changing its name for three reasons:
  • I'll soon push it on pub.dartlang.org and as discussed previously on this mailing list, a dart_ prefix doesn't make sense there.
  • The old ImmutableMap class name was clashing with the recently introduced ImmutableMap in the Dart SDK.
  • Some people seem to read "immutable" as something along the lines of "const" while you can in fact insert, delete, etc. elements in a PersistentMap: it just returns a new one.
I'm using this occasion to announce that the implementation of  PersistentMap is now complete (except for hashCode), very fast (see map_bench.dart) and thoroughly tested. I think it's ready to be used for serious stuff, but I'm waiting library v2 to freeze the API, in case I can implement some interfaces.

Which leads me to the poll: would you rather write

1.

import 'package:persistent/persistent.dart';
...
new PersistentMap();
...

2.

import 'package:persistent/persistent.dart' as per;
...
new per.Map();
...

3. Other (in this case, what?)

I like 2. except that apart from Map and List, most of the classes that will live there won't clash with Dart's standard library. So it's maybe too  high a price to pay.

Don Olmstead

unread,
Nov 14, 2012, 2:54:05 PM11/14/12
to mi...@dartlang.org
#1


--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
 
 

Reply all
Reply to author
Forward
0 new messages