[swift-evolution] Property with class and protocol type

L. Mihalkovic laurent.mihalkovic at gmail.com
Wed Jun 15 00:17:17 CDT 2016


Self correction inline...

> On Jun 15, 2016, at 6:27 AM, L. Mihalkovic <laurent.mihalkovic at gmail.com> wrote:
> 
> You need 3 long paragraph to explain it, the alternative I offer requires none.
> 
> https://gist.github.com/lmihalkovic/68c321ea7ffe27e553e37b794309b051
> 
> Regards
> (From mobile)
> 
>> On Jun 14, 2016, at 11:44 PM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> One more thing for clarity:
>> 
>> Any-class requirement: This must be the first requirement, if present. This requirement consists of the keyword class, and requires the existential to be of any class type.
>> 
>> Class requirement: This must be the first requirement, if present. This requirement consists of the name of a class type, and requires the existential to be of a specific class or its subclasses. There can be only one class name constraint, and it is mutually exclusive with the any-class requirement.
>> 
>> Nested any<...>: This requirement consists of another any<...> construct.
>> 
>> 
>> 
>> -- 
>> Adrian Zubarev
>> Sent with Airmail
>> 
>> Am 14. Juni 2016 um 23:42:00, Adrian Zubarev (adrian.zubarev at devandartist.com) schrieb:
>> 
>>> Which addresses the fact that nons of the proposals so far truly prevent absurde declarations like:


I realize that (typo aside - ipad is not meant for typing...), there is no doubt that all proposed solutions DO CATCH this type of absurd declarations. My point was about the cost of doing it from an implementation perspective as well as how intuitive it is looking at the code to understand how the syntax works without having to read long explainations. 

>>> 
>>> Let v: Any< UIViewController, UIWindow, UITableViewDelegate>
>>> Let v: UIViewController & UIWindow & UITableViewDelegate

>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160615/cd011c9d/attachment.html>


More information about the swift-evolution mailing list