Its amazing to see the error handling problem being properly addressed. The existing proposal is good, but I think we can iterate to make it better. I think we can simplify it and address these issues:
- Defining handlers as a stack is presumptious: it forces handlers to be side-effecting, and ruins interop with
defer
. return
statements are placed in handlers, ruining composition.- using
check
as a prefix function reduces code clarity. - a new anonymous function syntax is introduced into the proposal, but only available to
handle
. - the proposal introduces two keywords, but one may suffice
It's useful to take a step back and clearly state what we are trying to do: