Is dispatch on another type's parameter (::NotMyType{MyType}) piracy?

Whether or not defining these properties is a good idea (unlikely) I don’t see how defining methods on NotMyType{MyType} is piracy.

It might not be a good idea, mind you: people generally expect that NotMyType will behave in a consistent way, and it’s bad form to go against the grain that way.

But notmymethod(t::NotMyType{MyType}) can’t affect code you don’t own, which is the definition of type piracy. Any other notmymethod(t:NotMyType) is either less specific or concretely different from that signature, so this cannot change the method resolved in any other circumstance.

I could be missing something here, in which case I’ll need to change a couple methods on Vector{MyType} which I’ve defined while assuming that this isn’t piratical. So this is more of a motivated question than a definitive statement.

5 Likes