[swift-evolution] Issues with 0005-Better Translation of Objective-C APIs Into Swift

Gwendal Roué gwendal.roue at gmail.com
Wed Feb 3 11:21:24 CST 2016


>>> You wouldn't say "go to the garden and trim the plant: rhododendrons".
>>> It isn't necessary for comprehension.  Why do you feel characters: is
>>> necessary here?
>> 
>> Precisely because of what you stated a few lines above : "I don't
>> think *anybody* on this list believes [API] should [be relying on well
>> named inputs »:
>> 
>> 	let s: NSCharacterSet = .whitespaceAndNewlines
>> 	let content = listItemView.text.trimming(s)	// what?
> 
> That's not relying on well named inputs; it's relying on context, and
> *that* is perfectly alright.  We are never going to get to the point
> that you can do without context in reading code.  Proof: there's no
> label for the receiver, yet you're not complaining.  is
> 
>      v.text.trimming(characters: s)
> 
> somehow perfectly clear when
> 
>      listItemView.text.trimming(s)
> 
> is not?

Well, Dave, despite all your efforts to make points, one version requires more context than the other, and is thus less clear.

You are in the brevity team, that’s pretty clear. I’m quite happy that the brevity team exists and is powerful, because that team has already done a great job. `a + [1]` is so much better to the eye than `[a arrayByAddingObject:@1]`.

Yet… maybe the brevity team should not win everything, leaving both code and people exhausted.

Gwendal



More information about the swift-evolution mailing list