[swift-evolution] [Pitch] Property reflection

Austin Zheng austinzheng at gmail.com
Fri May 27 02:25:45 CDT 2016


Would you be willing to elaborate? Are you thinking of model objects whose properties are all completely hidden using 'private' and whose APIs are available only through methods? What if there existed something like "private(reflectable)", for properties you really want to keep both private and exposed to the reflection machinery? Or maybe a property behavior to do the same thing once that feature becomes a reality...

Austin


> On May 26, 2016, at 11:52 PM, David Hart <david at hartbit.com> wrote:
> 
> 
> 
>> On 27 May 2016, at 04:44, Austin Zheng via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> My personal preference would be to honor access control, and consider ser/de separately (especially since there are so many other possible considerations for that feature). Access control in Swift isn't just another safety feature, it's also a boundary for things like the optimizer.
>> 
>> To be honest, I expect the first big use of a feature like this to be turning JSON or XML received from a network call into model objects for an app. There are quite a few Objective-C libraries that use KVC to implement this functionality.
> 
> That's what I want to use it for and I'm fairly sure we need access to private properties for that.



More information about the swift-evolution mailing list