On Sun, Aug 5, 2012 at 1:18 PM, Stuart Halloway
<stuart.hallo...@gmail.com>wrote:

> 1. Simplicity is partially about having orthogonal primitives. A
> duplicate-removing collection factory cannot be sensibly used to implement
> a throw-on-duplicates collection factory, nor vice versa, so both seem
> equally primitive to me.
>

I think we're both in agreement that
duplicates-cause-the-creation-of-nonsensical-garbage (i.e., ArrayMap's
behavior in 1.2) is the least useful primitive :)  This is the thing that
really needed to be changed.


> 2. Given that both flavors are useful, they should both be provided, with
> explicit docs distinguishing them. This could involve new variants of the
> sorted collections for completeness.
>

I don't see a lot of evidence that people were clamoring for
throw-on-duplicates.  It strikes me as a misguided attempt to fix
ArrayMap's problem, rather than a desire to fill an actual need for this
specific kind of primitive.  Aren't changes to Clojure meant to be inspired
by providing solutions for actual problems that people are having, rather
than hypothetical ones?


> 3. People may differ about which flavor constructor the literals should
> use, but I don't see any arguments here warranting a breaking change.
>

Well, the problem is that the breaking change already happened.  And it
did, in fact, break my code.  I want to *undo* the breaking change.


>
> In short: can't this be fixed by fixing the docstrings?
>

I doubt it.  So much of the way maps and sets work in so many contexts
(e.g., assoc) are built around the idea that duplicate keys overwrite,
rather than triggering an error.  To provide equal support for
throw-on-duplicate would require vast changes to all the collection
functions, changes that are hardly warranted for the only use-case proposed
so far, namely to protect a user from shooting himself in the foot with a
very specific kind of typo.  And without that kind of consistency,
throw-on-duplicate semantics will remain a rare, quirky thing, that bites
users in very specific contexts.  Therefore, the only sensible solution is
to undo the breaking change and fix ArrayMaps properly.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to