C
Christopher Armstrong
Hi all. I'm playing around with Ruby because I like experimenting with
concurrency systems, and found out it has continuations.
I'm going to be calling user-defined code inside of a callcc block,
and the user-defined code will either return a value or raise an
error, and I want that value or error to be passed on to the
continuation.
I can't find any way to throw into the continuation. If there is no
way, can I request that a #throw method be added, or something like
that?
The only alternative I could think of is to have special code on the
calling side of the callcc that will watch the return value to see if
it is a array of two elements, the first being
:special-internal-throw-exception-bit, and if so, throwing the second
element of the array. This isn't what I want, though, especially
because it won't maintain the stack trace from the other side.
concurrency systems, and found out it has continuations.
I'm going to be calling user-defined code inside of a callcc block,
and the user-defined code will either return a value or raise an
error, and I want that value or error to be passed on to the
continuation.
I can't find any way to throw into the continuation. If there is no
way, can I request that a #throw method be added, or something like
that?
The only alternative I could think of is to have special code on the
calling side of the callcc that will watch the return value to see if
it is a array of two elements, the first being
:special-internal-throw-exception-bit, and if so, throwing the second
element of the array. This isn't what I want, though, especially
because it won't maintain the stack trace from the other side.