[swift-evolution] [Pitch] merge types and protocols back together with type<Type, Protocol, ...>

Thorsten Seitz tseitz42 at icloud.com
Thu May 12 14:40:10 CDT 2016

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.


> Am 12.05.2016 um 16:09 schrieb Adrian Zubarev via swift-evolution <swift-evolution at 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 (svabox at gmail.com <mailto:svabox at gmail.com>) schrieb:
>> protocol<> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160512/320f9461/attachment.html>

More information about the swift-evolution mailing list