This script, which divides two numbers ends up giving error “execution error, arithmetic overflow”. Is that normal ? Can’t find anything in documentation about that.
var c:Nat = 0;
while(c < 100000) {
Debug.print("test...." # Nat.toText(c) # " " # Nat32.toText(136/32));
c := c + 1;
}
Right before the end it prints
test…65471 160
test…65472 160
test…65473 160
test…65474 160
The -r option instructs moc to run your snippet in the interpreter. I have seen cases where loops were restricted to a certain number of iterations (maybe due to the interpreter not being tail-recursive in that case). My hunch is that the tight stack situation might crosstalk into the arithmetic evaluator.
Please note that the interpreter was only intended to try out ideas by running toy snippets/programs. It is not up to the same standards as the compiler, and has a number of shortcomings.