[swift-evolution] Fwd: [Pre-pitch] Conditional default arguments
dabrahams at apple.com
Fri Nov 24 21:55:43 CST 2017
Sent from my iPhone
Begin forwarded message:
> From: Matthew Johnson <matthew at anandabits.com>
> Date: November 24, 2017 at 3:55:34 PM PST
> To: Dave Abrahams <dabrahams at apple.com>
> Subject: Re: [swift-evolution] [Pre-pitch] Conditional default arguments
> You posted off-list. If that wasn’t intentional feel free to forward my reply to the list.
> Sent from my iPad
>> On Nov 24, 2017, at 5:32 PM, Dave Abrahams <dabrahams at apple.com> wrote:
>>> On Nov 24, 2017, at 3:11 PM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
>>> Adding language support for defining these more directly would eliminate a lot of boilerplate
>> 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.
> 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.
> 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.
> 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. :)
>> When you say “a lot of boilerplate,” how much do you mean?
> It’s a combinatoric explosion of overloads so it depends on the number of conditionally defaulted arguments.
> 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.
>> Is this a pattern you’ve observed outside your own code?
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution