Java also has chained exceptions, done manually

Shachar Shemesh shachar at weka.io
Fri Sep 7 06:57:54 UTC 2018


On 07/09/18 09:42, Don wrote:
> A loop is not possible in ordinary operation, any more than a loop is 
> possible in a depth-first traverse of a tree. But, what I don't know is, 
> what happens if there is a switch to a different fiber inside a 
> `finally` clause?
> I never considered that.

Each fiber maintains its own EH context. In theory (and I will not claim 
that I actually understand how this construct works), if you switch to a 
different fiber, you'll be out of the EH handling code until you switch 
back.

It caused quite a bit of headache for Mecca, as we do not switch fibers 
using the DRuntime mechanism. At the moment, Mecca just copies internal 
DRuntime implementation details while keeping our fingers tightly 
crossed that nothing gets borken.

I have, fairly high on my to-do list, a task to submit a PR to DRuntime 
to properly export this interface, thus removing access to private 
members from Mecca. Such a change would also allow DRuntime to implement 
the Fiber class somewhere other than core.thread.

Shachar


More information about the Digitalmars-d mailing list