[swift-evolution] Smart KeyPaths

Ben Rimmington me at benrimmington.com
Tue Mar 21 20:00:26 CDT 2017

Re: <https://github.com/apple/swift-evolution/pull/644>

> On 21 Mar 2017, at 13:16, Matthew Johnson wrote:
> I think the language is best served if all unbound members are accessible using the same syntax.  IMO this proposal does the right thing by choosing consistency with existing language features.  The current syntax for unbound methods works and hasn't caused any confusions I'm aware of in practice.  
> I don't feel too strongly about what syntax we use as long as it's concise and works for accessing all unbound members.  If people want to make the case for using `#` instead of `.` to do this I won't object but I won't be a vocal advocate either.  However, I think that should be an independent proposal if somebody wants to pursue it rather than a bike shed on this proposal which would only lead to inconsistency between key paths and unbound methods if it succeeds.

A new syntax for key paths and function references could resolve:

* the "compound name syntax for nullary functions" problem;

* the source-breaking change of SE-0042 (if reconsidered for Swift 4);

-- Ben

More information about the swift-evolution mailing list