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

Rob Mayoff mayoff at dqd.com
Wed Jan 27 15:48:29 CST 2016


>
> -  func respondWith(data: Data)
> +  func respond(data data: Data)
>
> This one is unusual. I don’t mind `respond(data: …)`, but generally
> there’s a word to the right of “with”, and here the “with” was just to
> imply the argument without naming it.
>
>
> The original ObjC method name was “respondWithData:”. “Data” restates type
> info, so SE-0023 stripped it off; this transformation makes it the first
> argument label.
>

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160127/97691e75/attachment.html>


More information about the swift-evolution mailing list