plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

Writing to method arguments leads to generation of erroneous code #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

method foo(x) {
    x = 23;
}

method main() {
    var local = 5;
    foo(local);
}

What is the expected output? What do you see instead?

The Plaid compiler accepts this program but the resulting Java code is 
erroneous because arguments, i.e. the PlaidObjects, are always passed as 
"final". I'm not sure what the semantics of writing to method arguments 
should be like in Plaid but if it's not allowed the compiler should print 
an error message.

Original issue reported on code.google.com by manuelmohr@gmail.com on 1 Jun 2010 at 12:09

GoogleCodeExporter commented 9 years ago
Yes, this should work and it needs to be fixed.

Original comment by mhahn...@gmail.com on 1 Jun 2010 at 2:47

GoogleCodeExporter commented 9 years ago
To be more clear on what I mean by "work," x should be a new reference that 
initially points to the same object 
that local does, but then changes.  Local should still point to 5 after the 
method call, i.e. the semantics should be 
the same as Java's.

Original comment by mhahn...@gmail.com on 1 Jun 2010 at 2:51

GoogleCodeExporter commented 9 years ago
Does not generate wrong code anymore but see issue 41 for another related 
problem.

Original comment by manuelmohr@gmail.com on 10 Jun 2010 at 7:39