[proposal] Persistent variables in functions/methods
Neek Sandhu
neek.sandhu at outlook.com
Tue Jul 17 05:14:36 UTC 2018
It’d work but won’t be beautiful. With this proposal, code would be much easier to reason about.
Also it breaks encapsulation (logical, semantic and syntactic), stuff should live where it belongs. If it “belongs” inside a function, then it should “live” inside function body `{ }`
In the same context, notice how we evolved from callbacks to Promises and now to async/await shorthands.
```javascript
const res = await fetch('http://example.com')
```
More pretty than
```javascript
fetch('http://example.com')
.then(res => /* impl */)
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180717/b319c5f5/attachment-0001.html>
More information about the es-discuss
mailing list