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

Douglas Gregor dgregor at apple.com
Wed Feb 10 16:13:14 CST 2016


> On Feb 10, 2016, at 1:43 AM, Ben Rimmington <me at benrimmington.com> wrote:
> 
> 
>> 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.

Yes, we could do this through some technical means, and it might make it easier to keep the APIs in sync.

	- Doug



More information about the swift-evolution mailing list