> If it “belongs” inside a function, then it should “live” inside function
body `{ }`

Agreed, but these values don't live _inside_ the function, but rather
_alongside_ the function. If it were inside, it would share the lifetime
with the function call (which it doesn't).


jhpratt

On Tue, Jul 17, 2018 at 1:14 AM, Neek Sandhu <neek.san...@outlook.com>
wrote:

> 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 */)
>
> ```
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to