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
|
Beta Was this translation helpful? Give feedback.
-
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
break
works 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
raise
handler'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 toloop
needs 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?
Beta Was this translation helpful? Give feedback.
All reactions