Fork me on GitHub
#clojure-dev
<
2020-09-23
>
cfleming04:09:35

What is the reasoning behind IObj only being implemented by the core collection implementation classes rather than the interfaces or the base classes? When working with these classes from Java, it leads to a fair amount of ugliness. Here I have a state variable which is an IPersistentMap. If I want the map without the meta, I have to: ((IPersistentMap) (((IObj) state).withMeta(null))) which is pretty nasty. Not even APersistentMap implements it.

alexmiller12:09:36

Generally I’d say that means it’s only a property of these particular coll implementations, not all such maps etc

alexmiller12:09:27

In other words, persistent maps etc don’t necessarily have editable metadata, but some impls do

andy.fingerhut14:09:07

In practice, it seems that most people who have gone to the trouble of implementing new collection types in Clojure have done the work to implement IObj, too. IEditableCollection is a much more involved one, and not as widely implemented.

alexmiller14:09:17

yeah, this is about what Clojure requires, not what others provide :)