Static Properties Follow
I recently finished running through the tutorial for creating TheSimplestLanguage. My question is why does the Java code generated in IDEA for TextConcept use a static field to represent the "myText" property? I would think each instance of that concept would want to store a different value for that property.
-Will
Please sign in to leave a comment.
Hello, William,
It generates static fields because it is constant and MPS uses this
constant in field accessors. It has generated code like this :
public String getName() {
return this.getProperty(BaseConcept.NAME);
}
public void setName(String value) {
this.setProperty(BaseConcept.NAME, value);
}
MPS uses map to store node properties so we have to key to access it.
This generated constant is this key. So everything is correct.
Konstantin.