[swift-evolution] [Pitch] Property reflection
charlie at charliemonroe.net
Fri May 27 03:28:27 CDT 2016
The private(reflectable) sounds reasonable, however, what about internal? It's impossible to include it in an invocation from within the module, but not including it when invoked from outside.
Would the behavior on private vars be non-reflectable by default and internal vars would be reflectable by default?
> On May 27, 2016, at 9:25 AM, Austin Zheng via swift-evolution <swift-evolution at swift.org> wrote:
> 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...
>> 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.
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution