Open thwfhk opened 10 months ago
Yes, I've seen this behavior too. You'll notice that test1'
does cause the program to terminate which is technically a sort of exception just without an exceptional status or an exception message. Additionally, since h0
does not require building a resumption due to the fact that it is not a ctl opration and due to the fact that Koka's implementation only builds a resumption / delimited continuation on demand, it works perfectly fine. In fact you can sort of model an object oriented program with just named handlers that have some local state and provides an interface to working with that state with fun
clauses.
Ah I see! It makes sense that test1'
raises an exception without any message, though a little misleading. Yes I understand that it is fine for tail-resumptive handlers like h0
to escape. Thank you!
To be clear, I think it should raise a message, I was just saying that it was technically exceptional behavior.
The Section 5 of the paper First-class names for effect handlers mentions that when a named but unscoped handler is not found at runtime, an exception will be raised. However, this seems to be not reflected in the implementation. Consider the following example:
Both
test0'
andtest1'
let the named handlerh
escape. I get the following output for them using Koka 2.4.2:It is also interesting that the two handlers
h0
andh1
have different behaviours after escape;h0
still correctly handles theread
operation even though there is no surrounding handler (test0'
), whileh1
outputs nothing (test1'
).