Replies: 1 comment 1 reply
|
Hi, thanks for the questions! Here are my attempts at answering them: Console hangingAs far as I can tell, the program doesn't stop because the Console We have a effekt/libraries/common/io/console.effekt Lines 10 to 21 in b034213 After using the def main() = {
with on[IOError].panic();
with console;
try {
guessTheNumberIO();
} with Random {
def randomByte() = resume(randomByteIO())
}
println("out of the main function");
}(where
|
Uh oh!
There was an error while loading. Please reload this page.
I have this "guess the number" game implementation in Effekt:
If you run this and enter "10", it prints "out of the loop" so the
breakworks as expected, and it also prints "out of the main function" which is the last statement inmain, but the process never terminates. Is this expected?I also have a question on how to simplify this code. In this block:
Can I "continue" in case of an exception, instead of returning a value? I tried this:
But it fails with
My understanding of the error is that the
raisehandler's return value needs to be anInt, whichl.continue()isn't.Is there a way to make this work?
I also tried
return l.continue()as if I understand this correctly, the process passed toloopneeds to return the control flow value toloop, but that also didn't work.Also a question: As far as I can see, there isn't a resumable exception effect in the standard library. Is there a limitation in the langauge that makes this impossible? Or is it just that you didn't have a use for it?
All reactions