[swift-evolution] [Pitch] Property reflection
charlie at charliemonroe.net
Fri May 27 08:47:57 CDT 2016
> I believe CoreData uses synthesized computed properties that access values stored in an internal row cache (or something along those lines).
Yeah, by creating a subclass of the original class, but that's not the point - accessing private variables can have legit uses. Yes, it can be abused, but this is the developer's responsibility IMHO.
>> I'm in favor of reflecting all vars by default (even private ones) with an option to opt-out.
> I much prefer the opt-in approach if we're going to allow for reflection to have different visibility. Access control should be explicit IMO.
>>>> or property behaviors (I think get-set behavior is fundamental to properties, although "behavior metadata" on the views might be useful).
>>> Not just behavior metadata. Someday we might have user-defined attributes which we would also want to have available. It’s probably better to make available anything that could be useful and isn’t too costly to provide. It could all live behind a `metadata` property so we don’t clutter the interface of the views themselves.
>>>> I'd also have to figure out how it would operate with generic types or existentials.
>>>> Anyways, thanks for reading all the way to the end, and any feedback, criticism, or alternative proposals would be greatly appreciated.
>>>> swift-evolution mailing list
>>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>>> swift-evolution mailing list
>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution