However, ISeq extends Sequential, which is what collections like
vector use to determine equality partition membership. Left this
way, using = to compare a vector and a counted-sorted-set with
the same contents will return true.
Interestingly, IPersistentStack does not extend Sequential.
So, should ISeq be changed to no longer directly extend
Sequential? Or perhaps counted-sorted-seq should participate
fully in both the set and sequential equality partitions? Is
there another option I'm not considering?
--Chouser
http://joyofclojure.com/
> Collection equality in Clojure is split into three partitions of
> types: sequentials, maps, and sets. Finger-tree's
> counted-sorted-set is primarily a set, but also supports walking
> from either end (first/rest from the left, peek/pop from the
> right), so my intention was for it to be in the "set" equality
> partition, but to implement ISeq (for first/rest) and
> IPersistentStack (for peek/pop) as well.
>
> However, ISeq extends Sequential, which is what collections like
> vector use to determine equality partition membership. Left this
> way, using = to compare a vector and a counted-sorted-set with
> the same contents will return true.
>
> Interestingly, IPersistentStack does not extend Sequential.
>
> So, should ISeq be changed to no longer directly extend
> Sequential?
Yes. Care will be required in making sure all appropriate concrete
derivees remain Sequential. It's a breaking change in that some
derivees not in Clojure may be relying on the derivation from ISeq, so
let's get this in now please.
Interface derivation stinks in general, it's just a major pain to do
without in Java.
Thanks,
Rich