On Fri, Sep 16, 2011 at 2:44 PM, Mark Engelberg <[email protected]>wrote:
> On Fri, Sep 16, 2011 at 11:20 AM, David Nolen <[email protected]>wrote: > >> >> Examining the Java sources it looks like the transient collections do not >> support contains? by design. >> >> David >> >> >> > Unfortunately, another design decision in Clojure is that contains? returns > spurious results, rather than an error, for things that do not support > contains?. As a consequence, when you try to use contains? with transient > sets (a perfectly reasonable thing to assume would work), you get zero > feedback that this is unsupported -- your program just returns incorrect > results. > > --Mark > Hmm... contains? doesn't throw when given a type that it doesn't support it. But then neither does get. One problem I see is that you can't map over a heterogenous collection with these fns if it does throw without enumerating the various types that are supported everywhere in your code. Protocols in ClojureScript, where they appear much earlier and can be properly extended to set of desired types (unlike Java interfaces), provide a better story here. David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
