plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

Identifiers that are Java keywords still don't work #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From what I can tell, there was a previous attempt to allow users to use
Java keywords as identifiers in Plaid by appending $plaid to the end.
However, it still doesn't work.

method main() {
    var protected = 5;
    protected + 7;
}

plaid.runtime.PlaidMethodNotFoundException: <UNKNOWN>@-1:-1 => Method
'protected.plus$plaid' not found in package 'coreExamples.booleanBug'.

It should be looking for protected$plaid.plus$plaid. The compiler left off
a $plaid somewhere.

Original issue reported on code.google.com by matta...@gmail.com on 3 Jun 2010 at 10:12

GoogleCodeExporter commented 9 years ago
I've made progress on this one. It now seems possible to safely use Java 
keywords as
identifiers, state names, and field names. The following code works 
("protected",
"synchronized", "abstract", and "continue" are Java keywords that are not Plaid
keywords or stdlib members.)

state protected {
    var abstract = 5;
    method continue() {
        java.lang.System.out.println("continue");
    }
}

method main() { 
    var synchronized = new protected with {abstract = 4;};
    java.lang.System.out.println(synchronized.abstract);
    synchronized.continue();
}

However, attempts to add objects to the stdlib with the same name as a Java 
keyword
(notable examples: true and false) still fail, with a 
java.lang.NoClassDefFoundError.

Original comment by matta...@gmail.com on 4 Jun 2010 at 8:21

GoogleCodeExporter commented 9 years ago
As we found out on Friday, this does only work on my laptop (64-bit Linux, 
Eclipse 
3.5.2, java 1.6.0_20 64-bit) -- for whatever reason. We should probably resolve 
this 
if we want to put a downloadable package on the site. Alternatively, we could 
also 
should some other name for true/false for the release.

Original comment by manuelmohr@gmail.com on 5 Jun 2010 at 4:29

GoogleCodeExporter commented 9 years ago
t and f would work. Ideally we'd like to fix this before the release, but that 
might not happen.

Original comment by matta...@gmail.com on 7 Jun 2010 at 8:20

GoogleCodeExporter commented 9 years ago
This is inaccurate. The real bug prevents two identifiers with the same name, 
differing only by case, from being in the same package. As the bug is in the 
JRE, we cannot fix this bug. We shall have to work around it but putting True 
and true in different packages in stdlib.

Original comment by matta...@gmail.com on 14 Jun 2010 at 2:40