[swift-evolution] Fwd: [Proposal] Union Type

Cao Jiannan frogcjn at 163.com
Fri Jul 1 12:39:48 CDT 2016


My proposal begins on February, still in May. But may no make attention to you.
This proposal is more about how to change the way of thinking optional/either type. Change the way of using generic to construct optional/either type.


> 下面是被转发的邮件:
> 
> 发件人: Joe Groff <jgroff at apple.com>
> 主题: 回复: [swift-evolution] [Proposal] Union Type
> 日期: 2016年7月2日 GMT+8 01:03:17
> 收件人: Cao Jiannan <frogcjn at 163.com>
> 抄送: swift-evolution <swift-evolution at swift.org>
> 
>> 
>> On Jul 1, 2016, at 2:08 AM, Cao Jiannan via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> 
>> 
>> Hi all,
>> 
>> I'm now officially proposal the union type feature for Swift. Please see:
>> 
>> 
>> https://github.com/frogcjn/swift-evolution/blob/master/proposals/xxxx-union-type.md <https://github.com/frogcjn/swift-evolution/blob/master/proposals/xxxx-union-type.md>
>> Introduction
>> 
>> Add union type grammar, represents the type which is one of other types.
>> 
>> var stringOrURL: String | URL = "https://www.apple.com"
>> 
>> 
>> I would be thankful if someone support this idea and give some advice. Thanks!
> 
> We touch on this in the "commonly proposed" list:
> 
> https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md <https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md>
> 
> Disjunctions (logical ORs) in type constraints <https://lists.swift.org/pipermail/swift-evolution-announce/2016-June/000182.html>: These include anonymous union-like types (e.g. (Int | String) for a type that can be inhabited by either an integer or a string). "[This type of constraint is] something that the type system cannot and should not support."
> 
> 
> -Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160702/93e6071e/attachment.html>


More information about the swift-evolution mailing list