[swift-evolution] Specify type of a delegate which conforms to a protocol
swift-evolution at haravikk.me
Thu Feb 11 02:58:09 CST 2016
> On 11 Feb 2016, at 08:39, Thorsten Seitz via swift-evolution <swift-evolution at swift.org> wrote:
> Jordan, I'm not sure if I understood you correctly, do you mean to use
> all<A, B> for intersection types (Ceylon's A & B), i.e. a type conforming to all listed types
> any<A, B> for union types (Ceylon's A | B), i.e. a type conforming to any of the listed types
> That would be fine, too, I think, while a bit heavier than Ceylon's syntax (though I seem to remember from another thread that there was a problem with using Ceylon's syntax in Swift, though the reason escapes me at the moment).
The main conflict for using & and | would be with BitwiseOperationsType, but personally I’m not sure that would be such a big deal, given that many developers may never need to fiddle with values in a bitwise fashion, and use of & or | on type names (rather than variables) seems a clear enough distinction to me.
That said, I prefer the use of all and any instead, as it’s more explicit in its meaning.
More information about the swift-evolution