try/catch/else

Alan Plum me at pluma.io
Tue Feb 13 11:35:04 UTC 2018


Going with python's semantics, finally should execute after else because else behaves analogous to catch. It's basically a "nocatch".

On Tue, Feb 13, 2018, at 12:30 PM, Isiah Meadows wrote:
> If you did `else` before `catch`/`finally`, that'd solve your problem. ;-)
> 
> The catch with `finally` (no pun intended) is this: does/should it
> execute *before* or *after* else?
> -----
> 
> Isiah Meadows
> me at isiahmeadows.com
> 
> Looking for web consulting? Or a new website?
> Send me an email and we can get started.
> www.isiahmeadows.com
> 
> 
> On Tue, Feb 13, 2018 at 4:48 AM, Alan Plum <me at pluma.io> wrote:
> > 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
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list