stackframe
stackframe copied to clipboard
Confusing property/get/set API
Expected Behavior
For the StackFrame object, I would expect a very simple way to get and set properties:
- Just access
stackframe.filename
to read the property - Set the property via
stackframe.filename = "myfile.js"
That should be the API regardless of whether or not it is implemented as a getter/setter pair. If there is extra work to do for either, then a getter/setter pair should be used with a hidden property like stackframe._filename
, which the user should not be instructed to access directly.
Current Behavior
The current API is confusing and does not make use of actual JS getters and setters. For example:
- What happens if I set the property directly? Is that the same as the set method?
- What's different about accessing the property vs. the get method? Both are used in the documentation with no explanation.
Furthermore, the typings for the set methods have zero parameters defined.