The code below works fine with Lox, but a bug has eluded my modded implementation for months. It might be interesting to have a similar case in the test scripts?
fun returnArg(arg){
return arg;
}
fun returnFunCallWithArg(func, arg){
return returnArg(func)(arg);
}
fun printArg(arg){
print arg;
}
returnFunCallWithArg(printArg, "hello world");
(used javascript for highlighting :-))
I happen to be experimenting with tail calls (reclaiming the call frame before calling if what is returned is a call) when I noticed that my port previously missed this. My bug had to do with the compilation of arguments relative to emitting OP_CALL.
Btw, I think it's really cool how the code above works in Lox to begin with. Thanks!
The code below works fine with Lox, but a bug has eluded my modded implementation for months. It might be interesting to have a similar case in the test scripts?
(used javascript for highlighting :-))
I happen to be experimenting with tail calls (reclaiming the call frame before calling if what is returned is a call) when I noticed that my port previously missed this. My bug had to do with the compilation of arguments relative to emitting OP_CALL.
Btw, I think it's really cool how the code above works in Lox to begin with. Thanks!