Closed remcollier closed 7 years ago
This bug has been fixed. It was caused by a System.exit(0) statement in the compiler that was reached when a formula consisted only of a single variable. The statement has been replaced by a statement that throws a ParseException indicating that the formula is not appropriate.
This may be a problem where formula variables are used. Also, a nice future enhancement could be autoboxing of the boolean variable (automatically adding the Logic.eval(...) code).
Given the natural use of booleans in guards, a common error (by programmers) is to do the same in ASTRA. Unfortunately, this does not work because variables are terms and guards are specified using formulae.
The workaround is to provide an eval() method as part of the 'astra.lang.Logic' API that is annotated as a formula and which returns true or false formulae depending on the value of the boolean term.
boolean result = true; if (Logic.eval(result)) { C.println("result was true"); } else { C.println("result was false"); }
Unfortunately doing the following:
if (result) { ... }
causes the compiler to terminate (causing the IDE to close).