Skip to content

Commit

Permalink
TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Dec 16, 2023
1 parent 5e94388 commit e013271
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,23 @@ with (obj) {
module.exports = () => { x = 2; };
}
```

Could output a 2nd `with ()` which catches const violations:

```js
x => with$0 => {
with ({get x() { return x; }, set x(v) { const x = 0; x = 0; }}) with (with$0) return () => { x = 2; };
}
```

Or for a silent const, a setter which does nothing:

```js
x => with$0 => {
with ({get x() { return x; }, set x(v) {}}) with (with$0) return () => { x = 2; };
}
```

If multiple `with` blocks, would need to put the "protector" `with` outside the last `with`.

This same technique could be used to prevent mutating consts in `eval()`.

0 comments on commit e013271

Please sign in to comment.