[swift-evolution] Smart KeyPaths

Matthew Johnson matthew at anandabits.com
Fri Mar 17 17:44:43 CDT 2017

Sent from my iPad

> On Mar 17, 2017, at 5:24 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
>> On Mar 17, 2017, at 3:17 PM, Michael LeHew via swift-evolution <swift-evolution at swift.org> wrote:
>> One thing that gets interesting with the scope-restricted visibility of KeyPaths, is what happens if an fileprivate KeyPath gets leaked out of the file?  That's a scary/maybe useful thing?
> I think that, as long as code within the `fileprivate` scope is responsible for passing the KeyPath out, that's an *extremely* useful thing. It essentially lets a privileged scope delegate its access to a less-privileged scope so it can do complex, potentially read-write work on its behalf. Imagine keeping an instance variable private, but allowing a serialization framework to access it through a key path; that'd be pretty handy.

Agree.  As long as it is manually vended it is semantically pretty similar to passing a closure that reads or writes.  That's the way I would think about it.

> -- 
> Brent Royal-Gordon
> Architechies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170317/2dabc32b/attachment.html>

More information about the swift-evolution mailing list