d at domenic.me (2015-05-11T16:39:34.828Z)
The binding identifiers are optional. You can do what you want already with:
```js
const lastOfThree = ([,, third]) => {
return third;
}
```The binding identifiers are optional. You can do what you want already with:
```js
const lastOfThree = ([,, third]) => {
return third;
}
```
The binding identifiers are optional. You can do what you want already with: const lastOfThree = ([,, third]) => { return third; } On Wed, Apr 29, 2015 at 12:40 PM, Elie Rotenberg <elie at rotenberg.io> wrote: > Using array destructuring assignment and constraining linting rules, I > often find myself having to chose names for bindings I don't intent on > using. I usually end up using a conventional ignore name, such as _ignore, > which I "void" to shut up the linter without adding exceptions. Besides the > linting problem (which can be solved by refining the linting rules), it's > still a conceptually useless binding. > Here's a contrived example: > const lastOfThree = ([first, second, third]) => third; > Which I usually end up rewriting: > const lastOfThree = ([_ignore1, _ignore2, third]) => { > void _ignore1; > void _ignore2; > return third; > } > This problem doesn't exist when using objects, since only the fields > specified on the LHS are bound. > I realize the bigger topic behind non-binding match is refutable pattern > matching, as per > http://wiki.ecmascript.org/doku.php?id=strawman:pattern_matching, but being > able to dismiss a matched (or unmatched) value from a destructuring > assignment seems a very often desirable feature when programming in a > functional style (eg. working with lists represented as 2-element arrays). > Most functional-style languages have a non-binding matching feature. > This topic has been discussed in the following topics: > - https://esdiscuss.org/topic/conditional-catch > - https://esdiscuss.org/notes/2014-07-30 > - https://esdiscuss.org/topic/conditional-catch-clause > Does anyone else feel the need for a specific means of dismissing a binding > from a destructuring assignment? Is pattern matching still on discussion? > Regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150429/f790804f/attachment.html>