> On 24 Aug 2016, at 00:14, Adrian Zubarev via swift-evolution
> <[email protected]> wrote:
>
> The basic design is fine, but I wouldn't want to add more noise to my code.
> We could keep (label: Protocol) as a shorthand form for (label:
> Any<Protocol>) similar to Optionals.
>
> What's the benifite of this anywasys? What exactly will this solve?!
>
> --
> Adrian Zubarev
> Sent with Airmail
The problem, as I understand it, is that when you use “MyProtocol” as a type,
there is sometimes a confusion as to whether you mean:
- the protocol itself, or
- anything which “is” that protocol (similar to how I might write “MyClass”
when meaning anything which “is” a MyClass, including MyDerviedClass), i.e. an
existential
See the discussion about protocol self-conformance. Any<MyProtocol> would make
it clear that you mean the latter.
I quite like using protocol names to refer to existentials. I’d like to
consider the other options for disambiguating the protocol type before giving a
+/- 1. This would fit nicely with another commonly-requested feature though:
the ability to constrain concrete types by protocol conformance - e.g.
UIView<MyProtocol>.
Karl
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution