[swift-evolution] Smart KeyPaths

Joe Groff jgroff at apple.com
Mon Mar 20 18:28:42 CDT 2017

> On Mar 20, 2017, at 4:01 PM, Kenny Leung via swift-evolution <swift-evolution at swift.org> wrote:
> Hi All.
> I’m not sure I’m understanding this proposal properly. In (old) Cocoa, two places where key paths were used extensively was EOF/CoreData, and WebObjects. I’m wondering how Smart KeyPaths will solve these two problems:
> 1. fetching data from a database and stuff it into objects that are not known at compile time (since you’ve written the framework ahead of time)
> 2. Token replacing text in a template, like ${person.firstName}
> Will there be some conversion of key paths to/from strings?

There won't be a conversion from strings in this initial proposal. That would be a reasonable thing to add later. For the use case of formatting strings, hopefully, there'll eventually be some way to build formatting templates that are well-typed instead of relying on parsing strings at runtime.


More information about the swift-evolution mailing list