Re: Destructuring by

2021-03-03 Thread #!/JoePea
Or maybe it would be ```js theFunction(obj., obj.); ``` to explicitly pass the particular properties, and would account for nested properties too: ```js theFunction(obj.foo., obj.lorem.); ``` #!/JoePea On Wed, Mar 3, 2021 at 6:29 PM #!/JoePea wrote: > > I think it is a good idea, but maybe

Re: Destructuring by

2021-03-03 Thread #!/JoePea
I think it is a good idea, but maybe we need to think about what the final syntax would be. About segregation, if the library changes the signature, then they'll have the whole source object, right? Maybe for the mentioned security the user would need to opt in: ```js theFunction(, ); ``` would

Re: Destructuring by

2021-03-03 Thread Augusto Moura
> that's basically the entirety of the syntax sugar proposals since ES2015, right? Definitely no, but talking about the syntax additions since ES2015, they are in one or more of the categories below: - avoid known footguns in the language (arrow functions and lexical this, classes and prototype,

Re: Destructuring by

2021-03-03 Thread Andrea Giammarchi
to expand further: you *could* access such reference via `arguments[0]`, but *that* won't be possible with arrow functions, as example, so that `({}, 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

Re: Destructuring by

2021-03-03 Thread Andrea Giammarchi
> 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,

Re: Destructuring by

2021-03-03 Thread Augusto Moura
> ```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

Re: Destructuring by

2021-03-03 Thread Andrea Giammarchi
The way I see it: it's just a convention/shortcut to have the destructured object around. ```js function augment({}, testCase) { if (/thing/.test(testCase)) value += testCase; } let any = {value: ''}; augment(any, 'thing'); ``` The magical behavior goal is to define side effects when

Re: Destructuring by

2021-03-03 Thread Augusto Moura
I don't know, the by reference destructuring seems a bit too much magical, a scoped variable that sets to a property to a object just sounds like the old `with` statement but reduced and more explicit, given is just a sugar and currently the problem is not a great of a pain point I would be very