Fork me on GitHub

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.

Alex Miller (Clojure team)12:09:36

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

Alex Miller (Clojure team)12:09:27

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


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.

Alex Miller (Clojure team)14:09:17

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