On 04/09/12 21:02, Andy Fingerhut wrote:
But what if they all consistently throw exceptions when encountering 
duplicates, including (set [5 5])?  That doesn't sound like what you want.

of course not...this also goes against set/map semantics from a mathematics point of view...the mathematical guarantees of set ('there will be no duplicates') are imposed by the set itself and not by the person/program/whatever using it! the same with map... since the ctor fns are considered the correct way of initialising sets/maps then I assume the dev team agrees with this simply because these versions do behave like true sets and impose the guarantees themselves. why not the literals?
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?


What if the default behavior for set & map literals were to quietly allow 
duplicates, with a new compiler option like the following that would give the 
error, for those that like it?

Now that sounds reasonable...of course the default I think should be the correct (no runtime exceptions)...


Perhaps it is starting to look like feature creep, but I thought I'd throw out 
the idea to see what happens.

well, yes you're not wrong on this, but I feel this is more serious/important than other dynamic vars in the clojure runtime (there are a lot !)...to be honest i don't think i would never turn this on so i would eventually forget that knob existed...again, assuming there are no dramatic performance improvements from doing so...having said that, i thought i would never use unchecked-math either but my board-game engine has unchecked math in most namespaces! ok, the quest for performance almost turned that project into a freakshow but at the end of the day i did use that knob.

Jim



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