plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

Some examples currently broken #42

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The turing.plaid and treeTest.plaid are currently broken, at least one of the 
issues is related to scoping.

Original issue reported on code.google.com by manuelmohr@gmail.com on 14 Jun 2010 at 2:38

GoogleCodeExporter commented 9 years ago
It seems that shadowing works for local variables but not for method parameters.
Running the code

state S {
    val foo = 10;

    method bar(foo) {
    }
}

method main() {
    var s = new S;
    s.bar(5);
}

prints the error "Cannot insert 'foo': already defined in current scope.". If 
'foo' is a local variable (and no method parameter) no error is printed. In 
Java, method parameters behave just like local variables and we should probably 
stick with that, too.

Original comment by manuelmohr@gmail.com on 14 Jun 2010 at 3:53

GoogleCodeExporter commented 9 years ago
The lookup rules appear to handle method parameters incorrectly, too:

state T {
    method foo() {
        23
    }

    method bar(foo) {
        java.lang.System.out.println(foo());
    }
}

method main() {
    (new T).bar(5);
}

the output will be 23 because the lookup chooses the field/method before 
considering the method parameters.

Original comment by manuelmohr@gmail.com on 14 Jun 2010 at 6:02

GoogleCodeExporter commented 9 years ago
I've fixed two small issues, so treeTest.plaid is working again. There's also 
an issue related to state change which is why turing.plaid is still broken.

Original comment by manuelmohr@gmail.com on 14 Jun 2010 at 9:41

GoogleCodeExporter commented 9 years ago

Original comment by manuelmohr@gmail.com on 16 Jun 2010 at 5:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Prefixing certain methods and fields with "this." managed to workaround the bug 
and make turing.plaid work. However, this does not solve the real problem.

Original comment by matta...@gmail.com on 1 Jul 2010 at 6:28