Re: Swift and parameter names
Re: Swift and parameter names
- Subject: Re: Swift and parameter names
- From: Rick Mann <email@hidden>
- Date: Mon, 29 Jun 2015 15:42:41 -0700
Here's an example (and this is what I frequently encounter) where requiring parameter names adds nothing but clutter:
let config = WKWebViewConfiguration()
self.webView = WKWebView(frame: self.webViewContainer.frame, configuration: config);
If Code Completion worked 100% of the time, and responded in a millisecond, I might be able to get by using its reminders. But it fails to complete at least half the time for me, and take several hundred milliseconds to display options (I invoke it with a keystroke, I don't wait for the timer), and it often displays many more options than I need.
I can't remember when a parameter name is required. So I write it without, then attempt to compile, then get told it's missing the "frame" name, so I add that, then figure I gotta add the config parameter, but I couldn't remember if it was config or configuration, so I had to wait for code completion, etc.
Moreover, when you're skimming the code, it looks a bit like the WKWebView constructor takes four arguments, not two. If you work the way I do, which is to skim pages of code for shapes (e.g., I know the constructor takes two parameters, so I can quickly zero in on a thing that looks like a call with a couple of parameters, delimited by white space, and then look more closely to see if it's the one I wanted. The extra islands of text from parameter names throws that off).
This happens ALL THE TIME. How often it happens that I really wish someone had named an unnamed parameter is never.
--
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