This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21424 - Futures: rename `catch`
Summary: Futures: rename `catch`
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-28 16:39 UTC by Mathias Bynens
Modified: 2013-03-28 16:55 UTC (History)
5 users (show)

See Also:


Attachments

Description Mathias Bynens 2013-03-28 16:39:15 UTC
`catch` used to be a reserved word in ES3: http://mothereff.in/js-properties#catch

It would be better to use a different name that doesn’t cause syntax errors in older browsers, so that feature detection for Futures can be done without `try`/`catch`.
Comment 1 Domenic Denicola 2013-03-28 16:40:50 UTC
This shouldn't matter. `catch` is not what you feature-detect on; `then` is.
Comment 2 Erik Arvidsson 2013-03-28 16:49:24 UTC
All browsers supports ES5. I would mark this as WONT FIX
Comment 3 Anne 2013-03-28 16:52:21 UTC
arv has spoken per expectations. Less work for me. Sorry Mathias!
Comment 4 Mathias Bynens 2013-03-28 16:53:30 UTC
(In reply to comment #1)
> This shouldn't matter. `catch` is not what you feature-detect on; `then` is.

(In reply to comment #1)
> This shouldn't matter. `catch` is not what you feature-detect on; `then` is.

Even then, any code that uses `catch` would throw a syntax error in ES3 environments.

As per ES3:

    if (featureDetect) {
      this.catch;
    }
    // SyntaxError


So, even if you don’t use `catch` in the feature detection snippet, it will still fail:

    if (featureDetect) {
      this.catch;
    }
    // SyntaxError

As long as `catch` is used it means all code relying on Futures should be wrapped in a `try`/`catch` block to avoid throwing in ES3 environments.
Comment 5 Erik Arvidsson 2013-03-28 16:55:02 UTC
If you care about ES3 (and you shouldn't) you can always use member lookup:

if (this['catch']) ...