Extending Set where it contains a generic type?

No, you would need generic extensions for that. Hopefully we'll have them soon-ish, although possibly not in 5.1.

See this discussion for more info: Parameterized Extensions

EDIT: Or, yes, sink the generic constraint down to the individual additions, as @cukr suggests. Although this won't work for computed properties, which cannot be made generic.

2 Likes