[swift-evolution] [Review] SE-0005 Better Translation of Objective-C APIs Into Swift

Dave Abrahams dabrahams at apple.com
Thu Jan 28 01:02:24 CST 2016


on Wed Jan 27 2016, Radosław Pietruszewski <swift-evolution at swift.org> wrote:

>>> 
>>> Can I tell, at a call site, whether `respond(data: someData)` is
>>> responding with someData, or responding to someData?
>>> 
>>> That is, can I tell whether someData is the response, or instead is
>
>>> something from the request that the receiver will use to compute
>>> the response?
>>> 
>>> If I see `respondWith(someData)` or `respondWith(data: someData)`
>>> or `respondWithData(someData)`, it's clear to me that someData is
>>> the response, while a hypothetical call `respondTo(someData)` would
>>> tell me that someData is the input to the response-computing
>>> algorithm.
>> 
>> I’d like to reiterate that my preference for cases like these would be:
>> 
>> 	respond(withData data: Data)
>> 
>> This way the action (function name) is still simplified to respond,
>> but the sentence structure remains for clarity, which I still think
>> is the best of both worlds.
>
> That seems very weird.
>
> I’d prefer
>
>    respondWith(data: Data)
>
> to “with” in the label.
>
> (But honestly it seems like an edge case for “with” here to have some
> meaning aside from just being a separator. Unless there’s a reliable
> heuristic to differentiate, `respond(data data: Data)` isn’t bad.)

I'm pretty certain that the argument label is needless in this case.
respond(x) is perfectly grammatical with exactly the right meaning.

-- 
-Dave



More information about the swift-evolution mailing list