On Wednesday, April 13, 2016 at 6:29:21 PM UTC-4, James Fairbanks wrote: > > Or do you make a constructor that validates C <: Associative{NTuple{N, > Int},T} at construction time? > What would be the appropriate error to throw in this case? >
Exactly! It's not currently possible to express the "triangular-dispatch-like" dependency between `C` and `T`, `N`, so you can just enforce it in the constructors. An ArgumentError here is probably sensible, but I often find that in cases like these the inner constructor becomes complicated enough that users always use the more convenient outer constructors. Just by limiting the signature of your outer constructor, you effectively end up with MethodErrors. If your default element is going to be zero(T), have you tried using SparseVectors? They should have *significantly* better performance than a dictionary in many cases.