As I know so far, Ruby is the only mainstream language that supports both call/cc
and try/catch/finally
(written as begin/rescue/ensure/end
block).
I am not familiar with Ruby, but my intuitive tell me that there are potential conflicts of that two, since call/cc
allows arbitrarily control flow and ensure
require some guaranteed control flow (some code path MUST be executed in a pre-defined situation, namely leaving the containing block).
So, are there any conflicts exists in the language? if so what is the defined behavior of the language in such a case? Especially, what happen if call/cc
being used in a begin/ensure
block or in the ensure/end
block? What if calling a captured call/cc
after the block contains ensure
clause?