Swift and parameter names
Swift and parameter names
- Subject: Swift and parameter names
- From: Rick Mann <email@hidden>
- Date: Wed, 24 Jun 2015 14:09:33 -0700
I'm really liking Swift 2, and after watching some of the WWDC2015 videos on the subject, I can't wait to use it in a real project.
But one area where it REALLY bugs me is that external parameter names are required. I can see their utility, particularly with regard to a set of default values and being able to specify just the ones you care about (I'm pretty sure this worked in a quick test I did).
I'm less convinced that using external parameter names in function calls improves readability or clarity.
But I don't understand the need to require the use of external names at the call site. If there's enough information available to the compiler at the call site to unambiguously choose a function or method to call, why must I supply the parameter names? Why not let the caller choose which external names to specify, and only emit an error when the result is ambiguous?
It's all complicated by the fact that the first parameter doesn't need to have an external name, but the rest default to having one, and it's the function definer who decides if they're required.
I'm going to write a bug about this, but it seems Swift 2 is more strict than than Swift 1.2 (as evidenced by the examples in the Language Guide), so I don't see Apple reversing course on this (even though I think it can be done with zero impact on existing Swift 2 code).
Thoughts?
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden