try/catch/else
Alan Plum
me at pluma.io
Tue Feb 13 09:48:00 UTC 2018
Yikes, thanks for pointing that out. I guess this could be resolved by having a lower precedence for `catch/else` than `if/else` or by enforcing the sequence `try/else/catch` (as `try` without `catch` or `finally` is a syntax error).
On Tue, Feb 13, 2018, at 2:06 AM, Waldemar Horwat wrote:
> On 02/08/2018 06:50, Alan Plum wrote:
> > I realise there is some ambiguity in using the else keyword for this (though I can't think of a meaningful opposite of "catch" either).
>
> Indeed. You can't use 'else' without breaking existing behavior. For example:
>
> if (foo) try {...} catch (e) {...} else {...}
>
> Waldemar
More information about the es-discuss
mailing list