babel / babel/proposals

Optional Catch Binding (Stage 4)

Open
#7 17 comments 8 reactions 0 assignees View on GitHub
Proposal Issue Transform: Done
Dominant language
No language data
Stars
435
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Champion: @michaelficarra
Spec repo: https://github.com/michaelficarra/optional-catch-binding-proposal/
Spec text: https://michaelficarra.github.io/optional-catch-binding-proposal/
Stage: -1 :)
> Moved to Stage 3 at the July meeting https://github.com/tc39/agendas/blob/master/2017/07.md

> Stage 4 at May 2018 meeting

This hasn't been presented to the committee as of this writing, but will be at the [July meeting](https://github.com/tc39/agendas/blob/master/2017/07.md). If it receives broad support it is likely to advance quickly, in my personal estimation.

It allows the binding to be omitted from a `catch` clause:

```js
try {
throw 0;
} catch {
doSomethingWhichDoesntCareAboutTheValueThrown();
}
```

or

```js
try {
throw 0;
} catch {
doSomethingWhichDoesntCareAboutTheValueThrown();
} finally {
doSomeCleanup();
}
```

This will need a (very small) change in Babylon, including a change to the AST (marking the catch binding as optional), and then a very small change to Babel.

This would make a great first contribution, I think!

**UPDATE:**
- [x] Babylon PR - https://github.com/babel/babylon/pull/634
- [x] Babel PR - https://github.com/babel/babel/pull/5956

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue points to the Babylon PR #634 and Babel PR #5956, both marked complete. Start by reviewing those linked changes and the optional-catch-binding proposal to verify the implementation and its AST handling; done means the proposal is supported by both projects and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers, tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.