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

Kevin Schlei kevinschlei at gmail.com
Wed Feb 3 09:46:35 CST 2016

On Tue, Feb 2, 2016 at 3:21 PM, Dave Abrahams via swift-evolution <
swift-evolution at swift.org> wrote:

> It trims.  In this case, it trims whitespace and newlines.  I think
> that's actually pretty clear.

I wouldn't explain what trimming: does to a new student by just saying 'it
trims', because by that explanation it sounds like it mutates its caller.
The clarity provided by the verbosity of the old method name will be missed.

I do appreciate your clarification of how my updating: example would not
meet the new standards, but I find all of the new standards difficult to
get right. If 'Proximity' is a type, wouldn't that be truncated because it
doesn't communicate semantics? It feels like half of the methods will have
clarifying qualifiers, and half won't. I think that will make the language
less consistent.

It is.  You just have a different idea about what creates clarity in
> source code.  IMO, clarity is provided by communicating semantics, *not*
> by repeating non-semantic details such as which specific types are in
> use.  By eliminating words that don't communicate semantics, you make
> the semantics clearer.  If we didn't believe in this approach, Swift
> wouldn't have type inference.

You've solved the repetition of type detail be removing all type detail.
That line is clear to you because you already know that .
whitespaceAndNewlines is an NSCharacterSet, and that string trims
characters instead of something else, like length. There is nothing written
on that line of code that tells me what .whitespaceAndNewlines is. It looks
like a poorly capitalized enum.

We don't always read code from within our tools. I can't command-click
variables on Stackoverflow, WWDC slides, GitHub. I could read 100 lines of
trimming: and still not know that NSCharacterSet exists.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160203/f1ad0fe4/attachment.html>

More information about the swift-evolution mailing list