Ceylon uses „&" for intersection types, i.e.

        SomeRealClass & SomeProtocol

and the bar („|“) for union types, i.e. 

        String | Int

That has proven to be very lightweight and readable in Ceylon where it is 
heavily used to good effect.


I agree with you that

        type<SomeRealClass, SomeProtocol> 

is much nicer than protocol<> for intersection types but to keep the door open 
for union types, I would prefer

        all<SomeRealClass, SomeProtocol>

This would allow

        any<String, Int>

to be used for union types.

-Thorsten


> Am 12.05.2016 um 16:09 schrieb Adrian Zubarev via swift-evolution 
> <swift-evolution@swift.org>:
> 
> protocol<SomeRealClass, SomeProtocol> 
> protocol<SomeRealStruct, SomeProtocol> 
> 
> This feels really odd to me. 
> 
> `type<SomeRealClass, SomeProtocol>` is more clear I’d say.
> 
> I think this would be a good addition to the type system and allow us to 
> build more complex and type save code.
> 
> But still I’d love to discuss if there might be any disadvantages to this 
> feature.
> 
> -- 
> Adrian Zubarev
> Sent with Airmail
> 
> Am 12. Mai 2016 bei 15:11:00, Vladimir.S (sva...@gmail.com 
> <mailto:sva...@gmail.com>) schrieb:
> 
>> protocol<> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org <mailto:swift-evolution@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution 
> <https://lists.swift.org/mailman/listinfo/swift-evolution>
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to