Re: Swift and parameter names
Re: Swift and parameter names
- Subject: Re: Swift and parameter names
- From: Graham Cox <email@hidden>
- Date: Thu, 25 Jun 2015 09:51:25 +1000
> On 25 Jun 2015, at 8:13 am, Rick Mann <email@hidden> wrote:
>
> I guess I disagree with this assertion. Generally, in a given body of code, the usage will be consistent, and of course there are the billions of lines of existing (C) code where no parameter names are specified.
Reminds me of when I first learned a ‘proper’ structured language for the first time, back in the very early 1980s. I’d previously only known BASIC, for my sins. The idea that a function call like foo( a, b, c ) had an implicit mapping to variables within that function based solely on their listed order struck me as surprising and fragile. Of course I rapidly got used to that and it’s not really a problem, but I still recall the slight raising of the eyebrow it produced when I saw it for the first time. (I’m from the Roger Moore school of facial expressions).
While we still have it in reality, naming the parameters is at least something like what I supposed I’d expected to see, back then. The ordering idea comes from the concept of a function in mathematics, so it’s not so strange, but I hadn’t realised that then.
I suppose the only further generalisation would be that the order wouldn't matter, only the names would, but it’s likely impractical, a performance bottleneck, and a likely source of confusion, and would suggest that the only functions you may as well permit are like foo( Dictionary: params );
Short version: I like Obj-Cs approach, and very glad Swift is keeping the idea around.
—Graham
_______________________________________________
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