The implementation of the Rascal meta-programming language (including interpreter, type checker, parser generator, compiler and JVM based run-time system)
I expect that the following code runs correctly. But it does not.
module experiments::vis2::Tst
import Prelude;
import util::Math;
data D = q(value \value=3)|r(value \value="OK");
public void main() {
for (int i<-[0..10]) {
D d = arbReal()<.5?q():r();
if (str v :=d.\value) println(v); else println("Also OK");
}
}
Output:
OK
OK
OK
OK
|project://rascal/src/org/rascalmpl/library/experiments/vis2/Tst.rsc|(91,1,<6,24>,<6,25>):
Expected str, but got int
However the following code runs correctly.
module experiments::vis2::Tst
import Prelude;
import util::Math;
data D = q(value \value)|r(value \value);
public void main() {
for (int i<-[0..10]) {
D d = arbReal()<.5?q(3):r("OK");
if (str v :=d.\value) println(v); else println("Also OK");
}
}
I expect that the following code runs correctly. But it does not.
Output:
However the following code runs correctly.
Output