Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for Keypath #644

Merged
merged 4 commits into from
Mar 30, 2017
Merged

Proposal for Keypath #644

merged 4 commits into from
Mar 30, 2017

Conversation

michael-lehew
Copy link
Contributor

No description provided.


let firstFriendsNameKeyPath = Person.friends[0].name

let firstFriend = luke[path] // han

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be let firstFriend = luke[firstFriendsNameKeyPath] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should. That was a Last Minute Change™ where the find-replace failed. :(

- fix example so that it compiles
- move to #keyPath syntax
- add a parameter label for the subscripts
- various prose tweaks to account for the above
@DougGregor DougGregor merged commit 1e70602 into swiftlang:master Mar 30, 2017
@jido
Copy link

jido commented Mar 31, 2017

You have this:

// or equivalently, with type inferred from context
luke[keyPath: #keyPath(.friends[0].name)]

Does this not conflict with backward compatibility?

There is no change or interaction with the #keyPath() syntax introduced in Swift 3. #keyPath(Person.bestFriend.name) will still produce a String

@michael-lehew
Copy link
Contributor Author

michael-lehew commented Mar 31, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants