[swift-evolution] Proposal: Change of syntax for class protocols

Daniel Valls Estella daniel at upzzle.com
Tue Dec 8 11:25:31 CST 2015


You are right, I was unaware of “inline” protocol composition. Nice! 

But I didn’t found that you can specify class…

Although I’d prefer just to list required protocols spaceseparated. 

I also think that it has to be explained as normal/basic option when explaining method declaration (not in protocols definition chapter).


Thanks!




> El 8 des 2015, a les 17:55, Stephen Celis <stephen.celis at gmail.com> va escriure:
> 
> On Tue, Dec 8, 2015 at 11:52 AM, Daniel Valls Estella via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> Just to clarify.
> 
> I think maybe it’s better to move away class constrain from protocol definitions 
> and enable such type of restriction when requesting elements alongside with type/protocol conformance requirements.
> 
> func doSomething(localvar: MyProtocol class)
> 
> Doesn't the following work? 
> 
>     func doSomething(localvar: protocol<MyProtocol, class>)
> 
> You could, of course, use a typealias or protocol inheritance to avoid "protocol<...>". 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151208/4ccbd730/attachment.html>


More information about the swift-evolution mailing list