<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">That’s an interesting proposal. Here’s a link for reference: <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160926/027287.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160926/027287.html</a><div class=""><br class=""></div><div class="">The one thing is the proposed syntax doesn’t handle enum cases without payloads. I think that could be handled by an optional Void, so this comment in the original proposal:</div><div class=""><br class=""></div><div class="">> <span style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">Only enum cases with a payload can be used with this syntax (it would make no sens for cases without a payload).</span></div><div class=""><br class=""></div><div class="">Would be changed to allow for empty payloads turning into Void?. For example:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="markdown-here-wrapper"><pre class="" style="font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em; line-height: 1.2em; margin-top: 1.2em; margin-bottom: 1.2em;"><code class="" style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; background-color: rgb(248, 248, 248); overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border: 1px solid rgb(204, 204, 204); padding: 0.5em 0.7em; display: block !important;">enum Result {
case success(Int)
case failure
}
let r: Result = foo()
let x: Int? = r.success
let y: Void? = r.failure
assert(r.success == Optional(42))
assert(r.failure == nil)</code></pre></div></div></blockquote><div class="">I think it’s a reasonable compromise, though I still think it’s a bit awkward for the common case. Looks like this is being postponed for now, so we’ll have to live with the alternatives.</div></div><div class=""><div class=""><br class=""></div><div class="">Andy</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 18, 2017, at 12:20 AM, Anton Zhilin <<a href="mailto:antonyzhilin@gmail.com" class="">antonyzhilin@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important" class="">AFAICS, Andy needs not default implementations of Equatable, but cases-as-optional-properties—this topic has also been discussed on the list.</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class=""><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important" class="">enum Result {
case success(Int)
case failure(String)
}
let r: Result = foo()
let x: Int? = r.success
let y: String? = r.failure
assert(r.success == Optional(42))
assert(r.failure == nil)
</code></pre><div title="MDH:QUZBSUNTLCBBbmR5IG5lZWRzIG5vdCBkZWZhdWx0IGltcGxlbWVudGF0aW9ucyBvZiBFcXVhdGFi
bGUsIGJ1dCBjYXNlcy1hcy1vcHRpb25hbC1wcm9wZXJ0aWVzLS10aGlzIHRvcGljIGhhcyBhbHNv
IGJlZW4gZGlzY3Vzc2VkIG9uIHRoZSBsaXN0LjxkaXY+PGJyPjwvZGl2PjxkaXY+YGBgPC9kaXY+
PGRpdj5lbnVtIFJlc3VsdCB7PC9kaXY+PGRpdj4mbmJzcDsgJm5ic3A7IGNhc2Ugc3VjY2VzcyhJ
bnQpPC9kaXY+PGRpdj4mbmJzcDsgJm5ic3A7IGNhc2UgZmFpbHVyZShTdHJpbmcpPC9kaXY+PGRp
dj59PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5sZXQgcjogUmVzdWx0ID0gZm9vKCk8L2Rpdj48
ZGl2Pjxicj48L2Rpdj48ZGl2PmxldCB4OiBJbnQ/ID0gci5zdWNjZXNzPC9kaXY+PGRpdj5sZXQg
eTogU3RyaW5nPyA9IHIuZmFpbHVyZTwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+YXNzZXJ0KHIu
c3VjY2VzcyA9PSBPcHRpb25hbCg0MikpPGJyPjwvZGl2PjxkaXY+YXNzZXJ0KHIuZmFpbHVyZSA9
PSBuaWwpPC9kaXY+PGRpdj5gYGA8L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0" class=""></div></div></div>
</div></blockquote></div><br class=""></div></div></body></html>