[swift-evolution] [Guidelines, First Argument Labels]: Prepositions inside the parens

Ben Rimmington me at benrimmington.com
Wed Feb 10 03:43:31 CST 2016


> On 10 Feb 2016, at 07:40, Douglas Gregor <dgregor at apple.com> wrote:
> 
> The core libraries need to match what the heuristics-based importer produces, or we won’t have source portability. If manual intervention is necessary, we have mechanisms to override the names produced by the automatic translation.

If the Swift Core Libraries were the "source of truth" for Foundation APIs, they could be annotated with @objc attributes, to override your heuristics in the Clang importer.

// Swift Core Libraries:
@objc(encodeWithCoder:)
func encode(into coder: Coder)

// Darwin platforms:
// Implicit NS_SWIFT_NAME(encode(into:))
- (void)encodeWithCoder:(NSCoder *)aCoder;

You'd have stable Foundation APIs which could be fine-tuned in Swift, but the @objc attributes would clutter the source code.

-- Ben


More information about the swift-evolution mailing list