When the start of a name describes both the type of the context and
the type of the result, and is followed by a preposition, the start of
the name is redundant with the 'self' value, so strip it off. For
example:
url.URLWithHTTPS
becomes
url.withHTTPS
Swift SVN r31701
When the prefix of a method/property name is restating the result
type, followed by "By" and then a gerund, drop everything up to the
gerund. For example:
func stringByAppendingString(string: String) -> String
becomes
func appending(string: String) -> String
Swift SVN r31683
When the type name we're looking at is a collection of some element
type, also try to match the plural form of the element type name. For
example:
- func deselectItemsAtIndexPaths(_: Set<NSIndexPath>)
+ func deselectItemsAt(_: Set<NSIndexPath>)
Swift SVN r31666
Identify gerunds by stripping off the "ing" and looking for a
verb. This lets us transform, e.g., "stringByAppendingString" to
"stringByAppending", since "append" is a verb.
Swift SVN r31660
The presence of a verb or preposition prior to the redundant part
provides a firm linguistic split that lets the actual argument fill in
for the reader. For other parts of speech (adjectives, especially)
it's awkward to transition from "reading part of the name" to "reading
the argument". This eliminates a significant number of bad omissions,
e.g., "setTextColor()" -> "setText()", and generally makes the
transformation more conservative.
Swift SVN r31656
"With" tends to have value in separating the verb of the base of a
method name from the description of the first argument. The poster
child here is "copyWithZone", where "copy(_:)" makes it sound like
we're copying the argument. We're considering a more nuanced rule that
can drop "With" in cases where it's not separating a verb from a
description of the argument; that will follow if we do come across
such a result.
Swift SVN r31627
While there are cases where it makes sense to drop the first argument
label in initializers---when they're primarily conversions---it's an
heuristic that produces poor results (e.g., init(_:) rather than
init(coder:)) more often than not. Thus, remove this heuristic.
Swift SVN r31626
We want to see the results of the omit-needless-words heuristics under
the assumption that we won't need to quote these argument labels in
the future, and it avoids some head-scratching to not have this
heuristic in place.
Swift SVN r31625
Specifically, "Ref", "Ptr", and dimensionality suffixes (1D, 2D, 3D)
in the type name should not prevent us from finding redundancy in type
information.
Swift SVN r31428
Sink the actual logic for omitting needless words way down into
Basic, so we can re-use it elsewhere. Tie the Clang importer into that
logic, mapping Clang types down to strings appropriately. NFC
Swift SVN r31233
llvm::Optional lives in "llvm/ADT/Optional.h". Like Clang, we can get
Optional in the 'swift' namespace by including "swift/Basic/LLVM.h".
We're now fully switched over to llvm::Optional!
Swift SVN r22477
Previously, this declaration:
typedef NS_OPTIONS(NSUInteger, NSABitmapFormat5) {
NSAA16d,
NSAB32d,
};
...would import with members .A16d and .B32d, which is not necessarily
correct. (Is it "NS_AA_16d", or "NSA_A_16d"?) Be more conservative here.
Swift SVN r17125
This makes a number of changes to the selector-splitting
heuristics. Specifically:
- Eliminate last-word splitting, and with it the notion of
multi-words. We only split at prepositions now.
- Introduce the notion of "linking verbs" such as "will" or
"should"; when these show up, we refuse to split a selector, which
helps with delegates.
- Eliminate the special case for "get" and "set". It wasn't
helping.
Swift SVN r16265