Type reflection only shows public fields and methods #7183
Labels
🛠️ compiler
Compiler
✨ enhancement
New feature or request
needs-discussion
Further discussion is needed prior to impl
Use Case
If I try reflecting on a class using the
@type
intrinsic, only public methods and fields are found:The root reason
bar
isn't made available is that if a Wing library declares a method or field as private, they're meant to be hidden to consumers, so it would be an leaky abstraction if the private fields could still be uncovered via reflection. Private or hidden fields or classes are meant to be implementation details.However, this could be overly restrictive if you're reflecting on a class that's within your own package/project. It could be nice if
@type(Foo)
included information about private fields/methods if the call is made in the same package as Foo, and continued to hide the fields/methods otherwise.Proposed Solution
No response
Implementation Notes
No response
Component
Compiler
Community Notes
The text was updated successfully, but these errors were encountered: