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
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
> 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,
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
> 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,
> ```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
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
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
8 matches
Mail list logo