Destructuring by &reference

Augusto Moura augusto.borgesm at
Wed Mar 3 17:18:51 UTC 2021

> ```js
> function stuff(source, extra) {
>   const {value, method} = source;
>   if (condition)
>   if (value === extra)
>     source.value = 'no more';
> }
> ```

I mean, in this case you can skip destructuring altogether, having a one
way and way only of value indirection is a Pretty Good Thing™ (even though
we already have proxys, globalThis and other indirection shenanigans), I
never felt annoyed of just using `source.value` or `source.method()`
instead of `value` and `method()`, again the proposal is just a debatable
syntax sugar for something we already can do. I wonder if we could ever do
the reference thingy in user-land with variable level decorators, if it
ever gets discussed again in the meetings. Would be still kinda fishy to
propose and implement
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list