Why is `catch` a [reserved] keyword?

Jeff Morrison lbljeffmo at gmail.com
Tue Jun 17 12:37:46 PDT 2014


That's a great point, thanks.

On 6/17/14, 12:36 PM, C. Scott Ananian wrote:
> My guess would be that `catch` is reserved so that (in a future
> version of JavaScript) this won't be ambiguous:
> ```
> try { stuff(); }
> catch(e1) { }
> catch(e2) { }
> ```
>
> Currently JS only allows a single catch clause.  But if it ever grows
> guarded catch expressions, then you would want to add multiple catch
> clauses.  All but the first could potentially be ambiguous with an
> invocation of a function named `catch`.
>    --scott
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list