<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=""><div class="">I agree, though it may seem counterintuitive at first. () is a value of unit type that exists here to satisfy the sema’s requirements that all branches are destructive, productive or defer to another productive branch.</div><div class=""><br class=""></div><div class="">~Robert Widmann</div><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 11, 2016, at 2:54 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Well, unless I'm mistaken, `()` here is a value. I can replace it with `3` and the compiler emits a warning about unused results. I'm guessing that since () is a value of type Void, the warning about unused results isn't triggered.<div class="">While it's true that `Void` causes an error, I can write `Void()` instead and everything compiles just fine, which is what the `()` is doing too. Seems fine to me?<div class=""><div class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Oct 11, 2016 at 1:43 PM, Erica Sadun via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">I thought this was long gone but today I found out it is still legal:<div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(186,45,162)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">switch</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#4f8187" class="">i</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2" class="">case</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#272ad8" class="">4</span><span style="font-variant-ligatures:no-common-ligatures" class=""> ... </span><span style="font-variant-ligatures:no-common-ligatures;color:#272ad8" class="">6</span><span style="font-variant-ligatures:no-common-ligatures" class="">: ()</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(209,47,27)" class=""><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:#272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures;" class="">: </span><span style="font-variant-ligatures:no-common-ligatures;color:#3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures:no-common-ligatures" class="">"Here"</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(186,45,162)" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">default</span><span style="font-variant-ligatures: no-common-ligatures;" class="">: </span><span style="font-variant-ligatures:no-common-ligatures" class="">break</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div><div class=""><br class=""></div><div class="">Is there a motivating factor for keeping this in the language? The compiler picks up on Void and emits an error. You'd think () would produce the same results but it doesn't.</div></div><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- Erica</div><div class=""><br class=""></div></font></span></div><br class="">______________________________<wbr class="">_________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div></div></div></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>