On Sep 4, 2012, at 4:53 PM, Jim - FooBar(); wrote:

> On 04/09/12 21:02, Andy Fingerhut wrote:
>> 
>> Stuart Halloway mentioned the idea of having two kinds of set/map 
>> constructor functions, one kind which quietly eliminates duplicates, another 
>> which throws an exception on duplicates.
> 
> Is this not a source of inconsistency? are there performance issues involved? 
> why not the correct thing on both/all cases?

I think the question arises more naturally for maps than for sets.

If someone types in the literal map {:a 5 :b 10 :c 13 :a -5}, what is the 
"correct thing"?

Some people might be thinking the correct thing is "I want the last key :a's 
value, -5, to win always, no matter if the key :a occurs more than once.  I 
never want an error for code like this."

Others might be thinking "Oh, that is obviously a typo in my source code.  I 
never intentionally want to specify the same key twice in any literal map.  I 
want the compiler to flag that as an error so I don't have to spend lots of 
testing/debugging time to find that typo."

Personally, I can see both of those points of view as reasonable.

Either there needs to be a configurable knob to select the behavior, or one 
group of people is happy, and the other are not.

Andy

-- 
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