jashkenas/coffee-script — Issue #2055: Destructuring fails with `new` due to operator precedence
Author: jed
Created: 2012-01-19 02:41:38+00:00
State: open

This CoffeeScript

```coffeescript
{length} = new Array
```

compiles to this JavaScript

```javascript
var length;

length = new Array.length;
```

which throws with `TypeError: number is not a function` because the `.` has higher precedence than the `new` operator. Ideally, this JavaScript would be generated instead:

```javascript
var length;

length = (new Array).length;
```