# \[Pre-pitch\] Conditional default arguments

**URL:** <https://forums.swift.org/t/pre-pitch-conditional-default-arguments/7123>\
**Category:** Discussion\
**Created:** [November 25, 2017, 3:55am UTC](https://forums.swift.org/t/pre-pitch-conditional-default-arguments/7123 "2017-11-25T03:55:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dabrahams](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dabrahams/32/9815_2.png) [@dabrahams](https://forums.swift.org/u/dabrahams)\
**Post date:** [November 25, 2017, 3:55am UTC](https://forums.swift.org/t/pre-pitch-conditional-default-arguments/7123/1 "2017-11-25T03:55:43Z")

</div>

> From: Matthew Johnson \<matthew@anandabits.com\>  
> Date: November 24, 2017 at 3:55:34 PM PST  
> To: Dave Abrahams \<dabrahams@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
> 
> > > 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.

> **···**
>
> Sent from my iPhone  
> Begin forwarded message:
> 
> > > On Nov 24, 2017, at 5:32 PM, Dave Abrahams \<dabrahams@apple.com\> wrote:
> > > 
> > > > On Nov 24, 2017, at 3:11 PM, Matthew Johnson via swift-evolution \<swift-evolution@swift.org\> wrote:
