<div dir="ltr">I like that approach a lot (and it would be nice to use separate labels vs. argument names in the case where they do have labels, too).<div><br></div><div>Enum cases with associated values are really just sugar for static methods on the enum type *anyway* with the added pattern matching abilities, so unifying the syntax seems like a positive direction to go in.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 9, 2017 at 1:20 PM Tim Shadel &lt;<a href="mailto:timshadel@gmail.com">timshadel@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yeah, that&#39;s much nicer than what I just sent! :-D<br class="gmail_msg">
<br class="gmail_msg">
&gt; On Jan 9, 2017, at 2:16 PM, Sean Heber &lt;<a href="mailto:sean@fifthace.com" class="gmail_msg" target="_blank">sean@fifthace.com</a>&gt; wrote:<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; I can’t speak for Tim, but I’d suggest just unifying the case syntax with functions so they become:<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; case foo(_ thing: Int)<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; And if you don’t actually need to ever *use* it by name in your enum properties/functions (if you even have any), then you could leave it out and write it like it is now, but that’d become “sugar”:<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; case foo(Int)<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; l8r<br class="gmail_msg">
&gt; Sean<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;&gt; On Jan 9, 2017, at 3:11 PM, Tony Allevato &lt;<a href="mailto:tony.allevato@gmail.com" class="gmail_msg" target="_blank">tony.allevato@gmail.com</a>&gt; wrote:<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; Ah, my apologies—the syntax highlighting in the thread was throwing off my e-mail client and I was having trouble reading it.<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; Associated values don&#39;t necessarily have to have names: I can write &quot;case .foo(Int)&quot;. Since your examples use the associated value label as the name of the value inside the body, how would you handle those label-less values?<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; On Mon, Jan 9, 2017 at 1:06 PM Tim Shadel &lt;<a href="mailto:timshadel@gmail.com" class="gmail_msg" target="_blank">timshadel@gmail.com</a>&gt; wrote:<br class="gmail_msg">
&gt;&gt; There are examples of associated values in the proposed syntax. Which parts should I provide more detail on?<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; On Jan 9, 2017, at 1:43 PM, Tony Allevato via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; While I do like the consolidated syntax more than most of the alternatives I&#39;ve seen to address this problem, any proposed solution also needs to address how it would work with cases that have associated values. That complicates the syntax somewhat.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; On Mon, Jan 9, 2017 at 12:37 PM Sean Heber via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; On Jan 9, 2017, at 2:28 PM, Guillaume Lessard via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt;&gt; On 9 janv. 2017, at 10:54, Tim Shadel via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br class="gmail_msg">
&gt;&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt;&gt; Enums get large, and they get complicated because the code for each case gets sliced up and scattered across many functions. It becomes a &quot;one of these things is not like the other&quot; situation because writing functions inside enums is unlike writing functions in any other part of Swift code.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; The problem I see with this is that enums and their functions inherently multiply each other. If I have 3 cases and 3 functions or properties, there are 9 implementation details, no matter how they&#39;re organized. There can be 3 functions/properties, each with a 3-case switch, or there can be 3 enum cases each with 3 strange, partial functions/properties.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; I can see why someone might prefer one over the other, but is either way truly better? The current way this works at least has the merit of not requiring a special dialect for enums.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; I’m not sure how to argue this, but I feel pretty strongly that something more like this proposed organization *is* actually better. That said, I do not think this conflicts with the current design of enums, however, so this is likely purely additive. The current design makes some situations almost comically verbose and disorganized, IMO, but it *is* right for other situations. We may want to have both.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; l8r<br class="gmail_msg">
&gt;&gt;&gt; Sean<br class="gmail_msg">
&gt;&gt;&gt; _______________________________________________<br class="gmail_msg">
&gt;&gt;&gt; swift-evolution mailing list<br class="gmail_msg">
&gt;&gt;&gt; <a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
&gt;&gt;&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
&gt;&gt;&gt; _______________________________________________<br class="gmail_msg">
&gt;&gt;&gt; swift-evolution mailing list<br class="gmail_msg">
&gt;&gt;&gt; <a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
&gt;&gt;&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>