My first Nim library, so newbie warning... The library is a persistent balanced tree data structure that can be used as a map or a set. It's mostly working and tested, but I ran into trouble trying to make a generic == to match the built-in Nim set equality operator. Since the comparison is on keys only (type K), the type of the values does not need to match (U and V here).
So, this works... func `<=`*[K,U,V](s1: BBTree[K,U], s2: BBTree[K,V]): bool {.inline.} = result = isSubset(s1, s2) Run but this gives **Error: cannot instantiate: 'V'** func `==`*[K,U,V](s1: BBTree[K,U], s2: BBTree[K,V]): bool {.inline.} = result = isSubset(s1, s2) and len(s1) == len(s2) Run Note that the type declarations are identical. Even if I make the bodies of the two functions identical, Nim still gives an instantiation error for the second one. Is there something special about == that is preventing this from working?