Here are some fairly contrived examples of code that will fail at runtime:
with rune (the rune animation errors):
import { animate_rune, heart, stack_frac } from 'rune';
function f(i) {
return i >= 10 ? heart : stack_frac(1/i, f(i + 1), heart);
}
animate_rune(1, 60, f);
with repl (evaluating any code inside the repl will cause an error):
import { set_evaluator } from 'repl';
function string_length(str) {
function f(i) {
return char_at(str, i) === undefined ? i : f(i + 1);
}
return f(0);
}
function evaller(code) {
if (string_length(code) === 10) {
return 0;
}
return evaller(code + '');
}
set_evaluator(evaller);
What's happening is that the transpiler does some magic to make tracking recursive calls in user defined functions easier, but it means that functions need to be called using callIfFuncAndRightArgs.
Either that or js-slang's implementation of handling user defined functions needs to change
Here are some fairly contrived examples of code that will fail at runtime:
with
rune(the rune animation errors):with
repl(evaluating any code inside the repl will cause an error):What's happening is that the transpiler does some magic to make tracking recursive calls in user defined functions easier, but it means that functions need to be called using
callIfFuncAndRightArgs.Either that or
js-slang's implementation of handling user defined functions needs to change