[swift-evolution] [swift-evolution-announce] [Review] SE-0089: Replace protocol<P1, P2> syntax with Any<P1, P2>

Thorsten Seitz tseitz42 at icloud.com
Sat Jun 11 15:41:20 CDT 2016



> Am 11.06.2016 um 14:44 schrieb Matthew Johnson <matthew at anandabits.com>:
> 
> 
> 
> Sent from my iPad
> 
>> On Jun 11, 2016, at 7:31 AM, Thorsten Seitz via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 
>>>> Am 11.06.2016 um 14:23 schrieb Brent Royal-Gordon <brent at architechies.com>:
>>>> 
>>>> The only magic would be that all type definitions (`protocol` etc.) which do not give a supertype they conform to, will implicitly conform to `Any`, i.e.
>>>> 
>>>> protocol Foo { … }
>>>> 
>>>> means
>>>> 
>>>> protocol Foo : Any { … }
>>> 
>>> Any is also the supertype of all structural types, and structural types cannot conform to protocols.
>> 
>> AFAIK Swift does not support structural types and I am not sure whether we should change that. In that case `Any` would become magic, yes.
> 
> Functions and tuples are structural types, although it is probably possible to make tuples syntactic sugar for a Tuple type of we get the necessary variadic generics support.

That's right, I forgot about them. Still I'd prefer the magic of having on type being the top type to having some syntax which does not work for structural types either and derive a top type from it.

-Thorsten 

> 
>> 
>> -Thorsten
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 


More information about the swift-evolution mailing list