<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 29, 2016 at 8:35 AM Adrian Zubarev &lt;<a href="mailto:adrian.zubarev@devandartist.com">adrian.zubarev@devandartist.com</a>&gt; wrote:<br></div><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="gmail_msg"><div class="m_-5836122890542383372bloop_markdown gmail_msg"><p class="gmail_msg">If we’re talking about non optional values here, then I don’t produce a possible expensive copy of my associated values (sure it depends on the type, COW etc.), but that’s my main point for excluding the the associated values.</p></div></div></blockquote><div>Does matching against _ cause a copy to be made? I wouldn&#39;t expect it to since it can never be used. If it does, I&#39;d argue that&#39;s a bug.</div><div> </div><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="gmail_msg"><div class="m_-5836122890542383372bloop_markdown gmail_msg">

<p class="gmail_msg">Somewhere in my code I also have a semi schema subscript which evaluates the enum case like this:</p>

<pre class="gmail_msg"><code class="m_-5836122890542383372swift gmail_msg">if case .double = $0 { return true } else { return false }
</code></pre>

<p class="gmail_msg">There is just no better way for this check. I wish I could write something like <code class="gmail_msg">return .double ~= $0</code> there.</p></div></div></blockquote><div>We agree on this—I&#39;ve had situations where I all I wanted to know was whether an enum value matched a particular case, and a Boolean case expression would be fantastic.</div><div><br></div><div><div>Re: your earlier message, I&#39;m trying to understand why you want to avoid wrapping your types in optionals when, if you can express both the presence and absence of them in an overloaded case, that effectively means they *are* optional? Is there a particular problem with Optional&lt;T&gt; that you&#39;re trying to avoid? If you&#39;re already pattern matching to detect the enum case, unwrapping the optional at the same time is no more difficult than if it were non-optional.</div><div><br></div><div>I&#39;m not convinced that overloading enum cases is something that should be supported, but I&#39;m about 90% on supporting default values. So I&#39;m trying to understand why you want this specific feature for your specific problem, and how it could apply elsewhere.<br></div><br class="inbox-inbox-Apple-interchange-newline"></div><div> </div><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="gmail_msg"><div class="m_-5836122890542383372bloop_markdown gmail_msg">

<p class="gmail_msg"></p></div><div class="m_-5836122890542383372bloop_original_html gmail_msg"></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="m_-5836122890542383372bloop_original_html gmail_msg"><div id="m_-5836122890542383372bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto" class="gmail_msg"><br class="gmail_msg"></div> <br class="gmail_msg"> <div id="m_-5836122890542383372bloop_sign_1480436917070613760" class="m_-5836122890542383372bloop_sign gmail_msg"><div style="font-family:helvetica,arial;font-size:13px" class="gmail_msg">-- <br class="gmail_msg">Adrian Zubarev<br class="gmail_msg">Sent with Airmail</div></div> <br class="gmail_msg"></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="m_-5836122890542383372bloop_original_html gmail_msg"><p class="m_-5836122890542383372airmail_on gmail_msg">Am 29. November 2016 um 17:19:16, Tony Allevato (<a href="mailto:allevato@google.com" class="gmail_msg" target="_blank">allevato@google.com</a>) schrieb:</p> </div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="m_-5836122890542383372bloop_original_html gmail_msg"><blockquote type="cite" class="m_-5836122890542383372clean_bq gmail_msg"><span class="gmail_msg"><div class="gmail_msg"><span style="color:rgb(0,0,0);font-family:&#39;helvetica Neue&#39;,helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);display:inline!important;float:none" class="gmail_msg">I suppose I&#39;m not seeing why it&#39;s important to exclude the associated values from pattern matching. What do you gain except saving a few characters?</span></div></span></blockquote></div></div></blockquote></div></div>