How to use "default scope" in Language Concept Constraints?

I have created a set of languages similar to the one in the tutorial (MyCalc, MyCalc2, etc...).

In the generated java however there is a "feature" that I do not find welcome:

the index for inputField is reused from one language to the other.

So, instead of each generated Java file having inputField0, the first language has inputField0, but the second has inputField1 and inputField2, and the third java file has inputField3.

I have followed the steps in the tutorial regarding the "property macro" template, using:

genContext uniqueName from "inputField" in context <no node>.

Would putting the correct value in the <no node> field above help?

If not, would changing the "default scope" in the constraints tab of the InputField concept Edit window fix this?

The existing documentation on "default scope" seems to indicate that is might, but no example is given on how to use it.


Comment actions Permalink

I have tried

genContext . unique name from " inputField " in context node . ancestor < concept = Calculator >

but this generates unique names for the variables such as:



However there is no need for this in Java, as the variables are private local variables inside 2 distinct classes.

I was just trying to avoid clutter and complication / weirdness in the generated Java files.


Comment actions Permalink
Hi, the unique names  generator is very simple - it is guarantied that it will not return the same  string twice during the generation session, but it doesn't take in account  visibility of the target element (in fact it has not a faintest idea about the  target element).
The behavior you  have got is all what MPS can offer, I afraid :-(

Please sign in to leave a comment.