-
Notifications
You must be signed in to change notification settings - Fork 211
Open
Labels
needs-discussionFurther discussion is needed prior to implFurther discussion is needed prior to impl✨ enhancementNew feature or requestNew feature or request🛠️ compilerCompilerCompiler
Description
Use Case
If I try reflecting on a class using the @type intrinsic, only public methods and fields are found:
class Foo {
pub foo() {}
bar() {}
}
let t = @type(Foo);
let cls = t.asClass()!;
log(Json.stringify(cls.methods.keys()));["foo","onLift","onLiftType","toInflight","isConstruct","toString"]
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
- Please vote by adding a 👍 reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.
- If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Discord.
Metadata
Metadata
Assignees
Labels
needs-discussionFurther discussion is needed prior to implFurther discussion is needed prior to impl✨ enhancementNew feature or requestNew feature or request🛠️ compilerCompilerCompiler