<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 25, 2017, at 3:26 PM, David Sweeris via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><br class=""></div><div class="">On Jul 25, 2017, at 12:38, Robert Bennett via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class="">Currently if you have the following enum:<div class=""><br class=""></div><div class="">enum&nbsp;E&lt;T&gt; {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case&nbsp;c(T)<br class="">}</div><div class=""><br class=""></div><div class="">then if T is Void, you have to write one of the following:</div><div class=""><br class=""></div><div class=""><font face="Inconsolata" class="">let x: E&lt;Void&gt; = .c(Void())</font></div><div class=""><font face="Inconsolata" class="">let y: E&lt;Void&gt; = .c(())</font></div><div class=""><br class=""></div><div class="">Looks awkward, no? In this case you can omit `&lt;Void&gt;` after `E` because it can be inferred, but if writing a (non-generic) function taking an argument of type `E&lt;Void&gt;`, then the `&lt;Void&gt;` cannot be omitted, and you still have to write `.c(())` for the case name.</div><div class=""><br class=""></div><div class="">Iā€™m proposing that for enum cases with a single associated value of Void type, or of a generic type that is equal to Void in some instance, you may omit the parentheses altogether and merely write</div><div class=""><br class=""></div><div class="">let x: E&lt;Void&gt; = .c</div><div class=""><br class=""></div><div class="">The rationale is twofold: first, double parentheses just looks bad; second, there is only a single value of type Void, which means the associated value of `.c` is trivially inferable, and hence should be omissible.</div><div class=""><br class=""></div><div class="">I am not proposing that a bare `E.c` imply a type of `E&lt;Void&gt;` ā€” `E.c` should still be illegal in the absence of specification of the generic type ā€” only that when the type is known to be `E&lt;Void&gt;`, `.c` can replace `.c(())`.</div><div class=""><br class=""></div><div class="">Thoughts?</div></div></blockquote><br class=""><div class="">My first response is +1</div><div class=""><br class=""></div><div class="">My second response is to ask just how much would it break things to expand this and allow omitting the argument anywhere its type is known to be Void? Maybe by implicitly providing a default value of `()` wherever there's a `Void` argument? Like make `func foo(x: Void) {...}` implicitly become `<span style="background-color: rgba(255, 255, 255, 0);" class="">func foo(x: Void = ()) {...}`?</span> I have a sneaking suspicion that this question's already been asked, but I'm not sure.</div></div></div></blockquote><div><br class=""></div><div>I think default arguments for associated values have come up before. &nbsp;I would love to see that added someday.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><br class=""></div><div class="">- Dave Sweeris</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>