to expand further: you *could* access such reference via `arguments[0]`,
but *that* won't be possible with arrow functions, as example, so that
`({&reactive}, maybe) => { if (maybe) reactive = true; }` is another
pattern that doesn't need the whole object around, or to be propagated,
when you can pass it via `{&reactive}` to anything else, covering then the
`arguments` point too.

On Wed, Mar 3, 2021 at 6:44 PM Andrea Giammarchi <
andrea.giammar...@gmail.com> wrote:

> > the proposal is just a debatable syntax sugar for something we already
> can do
>
> that's basically the entirety of the syntax sugar proposals since ES2015,
> right? also proxy and globalThis are *really* unrelated to this, imho,
> while leaking objects all over down the pipe is my major concern, something
> this proposal avoids, as no code will have a reference to the entirety of
> the source object, they'll deal with a known property name passed by
> reference, incapable of changing anything else in the source object ... so
> it's rather a signal, than a convention.
>
> this means composability, different classes/prototypes passed as
> arguments, and the certainty nothing can inspect, change, or deal, with the
> source, which means increased security, as opposite to pass instances and
> whole objects references around.
>
> You have a reference to a property, you don't see its source.
>
>
> On Wed, Mar 3, 2021 at 6:19 PM Augusto Moura <augusto.borg...@gmail.com>
> wrote:
>
>> > ```js
>> > function stuff(source, extra) {
>> >   const {value, method} = source;
>> >
>> >   if (condition)
>> >     method.call(source);
>> >
>> >   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
>>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to