<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><br><br><div id="AppleMailSignature">Sent from my iPhone</div><div><br>Begin forwarded message:<br><br></div><blockquote type="cite"><div><b>From:</b> Matthew Johnson <<a href="mailto:matthew@anandabits.com">matthew@anandabits.com</a>><br><b>Date:</b> November 24, 2017 at 3:55:34 PM PST<br><b>To:</b> Dave Abrahams <<a href="mailto:dabrahams@apple.com">dabrahams@apple.com</a>><br><b>Subject:</b> <b>Re: [swift-evolution] [Pre-pitch] Conditional default arguments</b><br><br></div></blockquote><blockquote type="cite"><div><span>You posted off-list. If that wasn’t intentional feel free to forward my reply to the list.</span><br><span></span><br><span>Sent from my iPad</span><br><span></span><br><blockquote type="cite"><span>On Nov 24, 2017, at 5:32 PM, Dave Abrahams <<a href="mailto:dabrahams@apple.com">dabrahams@apple.com</a>> wrote:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>On Nov 24, 2017, at 3:11 PM, Matthew Johnson via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Adding language support for defining these more directly would eliminate a lot of boilerplate</span><br></blockquote></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I think I understand what you’re trying to do, but it’s not obvious to me that this pattern is common enough to warrant investing language design resources or the increased language complexity of a dedicated feature.</span><br></blockquote><span></span><br><span>It’s not obvious to me either. It’s not something I come across frequently, but the overloads get painful pretty quickly in the cases where I do.</span><br><span></span><br><span>When I initially added it to the manifesto I put it in the “maybe”section and called it a “pre-pitch” for this reason. I posted on list because Doug had a positive response to the idea. It may well be a case where solving it directly at the language level isn’t appropriate. </span><br><span></span><br><span>I don’t plan to push hard for it if the response is lukewarm. I’m primarily interested in finding out what the response is at this point. :)</span><br><span></span><br><blockquote type="cite"><span> When you say “a lot of boilerplate,” how much do you mean? </span><br></blockquote><span></span><br><span>It’s a combinatoric explosion of overloads so it depends on the number of conditionally defaulted arguments.</span><br><span></span><br><span>The example I gave above is a simplification based on some code I have written. This code already requires an overload set for other reasons. Each of the base overloads requires a set providing emulated default arguments. The total size of the set is uncomfortable. </span><br><span></span><br><blockquote type="cite"><span>Is this a pattern you’ve observed outside your own code?</span><br></blockquote><span></span><br><span>No, but I haven’t been actively looking for it. Part of the reason for posting to the list is to seek feedback and see if others have had similar cases arise. </span><br><span></span><br></div></blockquote></body></html>