plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

Referencing booleans #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This code does not work. It may be a tautology, but it should also
certainly work.

method main() {
    if(True) {
        java.lang.System.out.println("True.");
    }
}

It should print out "True." Instead, it throws the exception
java.lang.RuntimeException: Pattern match exhausted.

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

GoogleCodeExporter commented 9 years ago
This code shouldn't work because True is a state. The following works:

val t = new plaid.lang.True;
if (t) {
    java.lang.System.out.println("True");
}

Maybe it would be a good idea to provide the programmer with two global vals 
named 
"true" and "false" in the standard library.
It is interesting though that a state name is accepted in this context, might 
be 
worth to look at.

Original comment by manuelmohr@gmail.com on 3 Jun 2010 at 6:27

GoogleCodeExporter commented 9 years ago
That is correct. I will work on adding "true" and "false" to the standard 
library.

Original comment by matta...@gmail.com on 3 Jun 2010 at 7:08

GoogleCodeExporter commented 9 years ago
Can't add "true" and "false" as globals until this is fixed. "t" and "f" could 
serve
as a temporary fix.

Original comment by matta...@gmail.com on 3 Jun 2010 at 10:13

GoogleCodeExporter commented 9 years ago
Will work around issue 37 by putting True and true in different packages 
(plaid.lang.globals suggested.)

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

GoogleCodeExporter commented 9 years ago

Original comment by matta...@gmail.com on 14 Jun 2010 at 4:22