[swift-evolution] [Pitch] Enforce argument order for defaulted parameters
william at housedillon.com
Wed Mar 30 13:24:42 CDT 2016
I think Matthew and Erica bring up good points here.
When considering this change, it's worthwhile considering the effect it would have on the package manager (among the other cases that they may use privately). Currently, the package.swift's centerpiece is the initialization of the Package class. If strict ordering is enforced would that lead to undue confusion when people naively reorder the setting of these parameters?
> On Mar 30, 2016, at 11:20 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
> One place where I believe argument re-ordering is useful is with memberwise arguments when you are initializing an instance. Order usually plays no significant role with these arguments which are in some sense similar to assignment statements (which are inherently re-orderable).
> In fact, I have found myself wishing non-defaulted memberwise initializer parameters were re-orderable at times, especially when using the implicit memberwise initializer for a struct. Source order for property declarations does not always match what makes the most sense at the initialization site (something that was pointed out numerous times during the review of my memberwise init proposal).
>> On Mar 30, 2016, at 11:59 AM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>> Many people are surprised when they find out defaulted parameters can be reordered, unlike required arguments. This special case adds complexity to the language, and runs against our general trend of treating argument labels as a significant part of an API's name, and preferring a single way of writing API calls. I think it's worth revisiting this design choice—is the special case worth the complexity? How many people take advantage of default argument reordering?
>> swift-evolution mailing list
>> swift-evolution at swift.org
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution