Add dynamic method/instance variable access? #2990
Labels
closed-duplicate
Closed in favor of an existing report
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @snitko
I'm not sure if this issue is implied by the "add reflection" thread here, but I just wanted to be more specific. I want to be able to do something like this
class Model {
// ... setting instance variables
Model(Map fields) {
fields.forEach((k,v) => this[k] = v);
}
}
It obviously doesn't work, because
this
doesn't have a[]=
method. I would be nice to be able to call methods (in this case, setters) dynamically or maybe even set instance variables names dynamically.The text was updated successfully, but these errors were encountered: