Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[6.d] Attach ex. handler to
start in sink context
Per 6.d-prep: https://github.com/perl6/6.d-prep/blob/69a7d9c5e5d8ff3bed69c6f33577ada4bb8470be/TODO/FEATURES.md#make-start-blocks-in-sink-context-attach-an-error-handler I've used the normal handler instead of `uncaught_handler` the 6.d-prep notes say because I don't know how to use the latter (and noticed that note too late). I'm also unsure if the uncaught_handler handles custom exception handlers; this commit does. When detecting the `start` was in sink context, we create a thunk with the call to original block and use the `handle` op to handle the exception. The thunk is there so the user can use their own `CATCH`. One problem that I noticed is code like `sub foo { start die }()` does NOT attach the handler, because sinkage of stuff like that requires calls to `.sink` method instead of the `unwanted` Actions helper.
- Loading branch information
6ee5f75There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to include in the commit message: I did try changing the
Routine:D's trait toCode:Dinstead, but the setting failed to compile in that case due to some error about Hash, hence why I added it as a separate multi.