TL;DR: I know MPS 2017.2 does not update field references. The question is how to get it right, so DSL users would not have to retype all the program in case of a single "variable type change"
Here's an example for MPS's base language:
public class Foo {
public int x;
public int y;
}
public class Bar {
public long x;
public long z;
}
public void test() {
Foo a;
a.x = 1; // "x" points to the field of class Foo
a.y = 1;
}
If I update Foo
with Bar
in Foo a;
, then the test code would look like the same
public void test() {
Bar a;
a.x = 1; // "x" still points to the field of class Foo
a.y = 1; // Of course this reference is now invalid, however MPS does not underline that
}
If I update the type of variable a
to Bar
, then the code in test
method would still reference fields of Foo
. Of course, check model
identifies the broken reference, however I wonder what is the expected way to solve that kind of DSL issues in MPS?
Should "on update" scripts find all the "field usages" and update model accordingly? Should "field type updates" be forbidden and ask user confirmation? (e.g. some sort of refactoring or whatever intention)
I'm building 61131 ST language in MPS, so I'm looking into "static typed language" kind of DSL.