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

marc hoffman mh at remobjects.com
Wed Feb 3 12:32:46 CST 2016


>> Sorry for the premature send! Continuing:
>> 
>> let content = listItemView.text.trimming(.whitespaceAndNewlines)
>> 
>> For a beginning programmer, there is no indication of what .trimming does. In this case, it returns a new string instance. Where is that explained? In the documentation. Nowhere near the method call.
>> 
>> So are we reduced now to looking up documentation just to read code? What does this line do:
>> 
>> let next = current.updating(p)
>> 
>> It's 100% unclear because you're relying on parameter names to contain all the hints. But this line:
> 
> I think it's only unclear because p is not a descriptive name (next and current aren't terribly helpful either), and we don't have any context or type information.
> 
>> let next = current.locationByUpdatingProximity(p)
> 
> This is definitely more clear when you completely separate these lines from their context, but code isn't written or read in complete isolation like this, so I think these examples significantly exaggerate the ambiguity of the pattern in the real world.
> 
> Even if you only make the minor change of renaming p to proximity (which is really what it should be), the first example becomes pretty clear:

i could not agree more. i find this proposed change terrible, and it kills one of the core things that make Cocoa APIs great.


More information about the swift-evolution mailing list