The contains? function, given a collection which is not an associative (Map, Set, String, array), returns false instead of throwing an exception.
This is a subject of confusion when people call contains? on sequential collections like lists, and on associative collections which do not implement the Associative interface.
Other predicates, such as even?, throw an exception when passed arguments of an invalid type.
This seems to be working properly, but what about vectors?
The doc string for contains? covers the vector and Java array case explicitly. I'm not saying that this behavior shouldn't change, but at least it is well documented what it currently does in these cases.
Agreed. I just want to make sure that we are still ok with this functionality given that things are changing. Are there others (Stuart) that want to chime in here and make the intentions clear? If this is good then I would consider this screened and ready.
Vector is Associative, so supporting contains? is valid even if it does not do what people might expect:
All I'm trying to change here is have contains? throw an exception if the argument is not Associative. The current behavior (returning false) was hiding a bug in my code.
I do not consider this a breaking change. I believe the docstring of contains? leaves room for this interpretation, but Rich will have the final say.
Perfect. I just wanted to make sure that this was intended.