--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
@David: not sure this can be of any interest for you, but here are some other comments on your design:
> Built Collections do a deep comparison against other Built Collections of the same type, only. Hashing is used to make repeated comparisons fast. Built Collections are Hashable ... Built Collections do compute, and cache, a deep hashCode...
The library is trying to do the impossible. There's no guarantee that keys/values are immutable. Just because they are placed in immutable container doesn't make them immutable themselves. Making this deep equals/hashCode a default means that library promises more than it can accomplish. But even if it could, there's a big question whether such default would be warranted. I can't think of too many common use cases where such "deep treatment" is necessary (except testing).
> Built Collections Reject Nulls ... Built Collections Require Generic Type Parameters... Built Collections Reject Wrong-type Elements, Keys and ValuesThis is an attempt to create a small island of java in dart. I don't think it's a good idea - it's inconsistent with the rest of the language/libs. It's like trying to be more pious than the Pope.
Take it lightly though, you can always say: this is what we needed, so that's what we implemented. I can't argue with that.
P.S. Good quote:
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away (Antoine de Saint-Exupery)
> list = list.with((b) => b..add(4)..add(5));Yes, basically, that's what I meant. I like this variant :-)
I agree with Thomas, this should have been the built in default from the start. It may not be perfect for the theorist, but for those who actually practise programming in large multi-person projects this is essential. I have been in projects where defensive copying was a pattern and it was not pretty at all. Basically for all projects where multiple persons are involved you will have code that you write that is published to be consumed by someone else's code which in turn will publish that to be consumed by someone else's code etc. If you don't know if things are mutable in those scenarios you will fall in to the defensive copy pattern.
It is also useful for caching. You do not want to cache things that are mutable. If someone keeps a reference around and then mutates it, the cache will also be updated which is probably not what you want. Been there done that too.So anyway, thanks a lot for publishing this package! :-)
Strong(er) typing is coming? https://code.google.com/p/dart/source/detail?r=45190
Strong(er) typing is coming? https://code.google.com/p/dart/source/detail?r=45190