>>>>> "Todd" == Todd Gillespie <toddg / mail.ma.utexas.edu> writes:

First off, thanks for the example.  That at least gives me something
to go on.

    >> However, I can't find an obvious way to respond to Ruby
    >> exceptions, control threads, or to insulate myself from
    >> potential loops in the executed code.

    Todd> 'insulate myself from potential loops'?  Do you mean the
    Todd> halting problem?

    Todd> What's a step?  A block, a line, what?

I hope you'll forgive the re-ordering, but these seem to go together.
If you have a bytecode-style interpreter, a step would be one
bytecode.  Presumbably, apart from time in C extensions, that would
have a predictable time to execute.

Similarly, if you could time-slice the bytecode like that, you can use
higher level logic to say things like "Hm.  That ruby function's taken
1e6 bytecode cycles so far, and it still isn't done.  Something's
wrong, time to pull the plug."

I'm not sure if the Ruby structure would be amenable to something like
that, since I don't know it.

    Todd> As for the rest, there is a wealth of API to handle
    Todd> top-level Ruby exceptions and such.  If you're more specific
    Todd> I can try to help.

Where in the source is the API; somewhere in error.c?  I can look for
it.

--Johann