Simo Costa (2018-11-29T08:00:49.000Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybeyou'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in a object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```

f(arg1, arg2, arg3);

```

you could do like that to store them into an array:

```

function f(...args){

/* code */

}

```

but something like that won't work if u want gather them into a obj:

``

function f({...obj}){

/* code */

}

```

My proposal could solve this problem.


P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```

f( { arg1, arg2, arg3 } );

```
to make that work:

``

function f({...obj}){

/* code */

}

```
you cannot do something like that directly:

```

function a ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {}

```
My proposal theoretically could solve this "problem" too.

Il giorno gio 29 nov 2018 alle ore 00:59 Ron Buckton <
Ron.Buckton at microsoft.com> ha scritto:

> Dart has something like this:
> https://www.dartlang.org/guides/language/language-tour#constructors
>
>
>
> ```dart
>
> class Point {
>
>   num x, y;
>
>
>
>   // Syntactic sugar for setting x and y
>
>   // before the constructor body runs.
>
>   Point(this.x, this.y);
>
> }
>
> ```
>
>
>
> I could see a form of BindingElement (et al) that allows `this` or `this`
> `.` BindingIdentifier:
>
>
>
> ```js
>
> class Point {
>
>   constructor(this.x, this.y) {}
>
> }
>
> new Point(10, 20).x; // 10
>
>
>
> class Foo {
>
>   constructor(this.x, { y: this.z, …this }) {}
>
> }
>
> const f = new Foo(1, { y: 2, w: 3 });
>
> f.x; // 1
>
> f.z; // 2
>
> f.w; // 3
>
> ```
>
>
>
> TypeScript has something similar for constructors in the form of
> “parameter property assignments”, but they are triggered by the presence of
> an modifier (i.e. `public`, `private`, `protected`, `readonly`).
>
>
>
> Ron
>
>
>
> *From:* es-discuss <es-discuss-bounces at mozilla.org> * On Behalf Of *Claude
> Pache
> *Sent:* Wednesday, November 28, 2018 11:46 AM
> *To:* Simo Costa <andrysimo1997 at gmail.com>
> *Cc:* es-discuss at mozilla.org
> *Subject:* Re: Proposal for faster this assignments in constructor
> functions
>
>
>
>
>
> Le 28 nov. 2018 à 19:32, Simo Costa <andrysimo1997 at gmail.com> a écrit :
>
>
>
> In costructor functions and in the constructor() method in ES6 classes is
> easily to fall in the following pattern:
>
> F(par1, par2, ..., parN) {
>
>   this.par1 = par1;
>
>   this.par2 = par2;
>
>   ...
>
>   this.parN = parN;
>
> }
>
>
>
> So my proposal is to avoid those repetitions  by prefixing a dot *.* to
> each parameter:
>
> F(.par1, .par2, ..., .parN) {}
>
> Simple but quite useful. More info here: https://github.com/jfet97/proposal-fast-this-assignments <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjfet97%2Fproposal-fast-this-assignments&data=02%7C01%7Cron.buckton%40microsoft.com%7C259306c32d9d4c9d053308d6556a246a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636790311735674930&sdata=8fEkmw%2BDL94JClmv9jv7c13okC7Myd4kxCNNSNjA1LE%3D&reserved=0>
>
>
>
>
>
> Simple, but a brand new and nonobvious syntax, for a relatively limited
> use case.
>
>
>
> Also, just one dot is too inconspicuous. At the very least, I’d prefer:
>
>
>
> ```js
>
> function F(this.par1, this.par2, this.par3) { }
>
> ```
>
>
>
> whose meaning is somewhat more intuitive.
>
>
>
>
>
> Also noteworthy: in many cases, you can already reduce repetition with the
> combination of `Object.assign`, improved syntax literal, and imagination;
> see:
>
>
>
> http://2ality.com/2014/12/es6-oop.html#use-cases-for-objectassign
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2F2ality.com%2F2014%2F12%2Fes6-oop.html%23use-cases-for-objectassign&data=02%7C01%7Cron.buckton%40microsoft.com%7C259306c32d9d4c9d053308d6556a246a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636790311735684942&sdata=1L%2F6iyFqjV7EWd51XhKUWGUnKTrGCW%2FXU6o4RAQESVA%3D&reserved=0>
>
>
>
>
>
> —Claude
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20181129/b51fc0e8/attachment-0001.html>
andrysimo1997 at gmail.com (2018-11-29T08:34:21.387Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.
\
\
P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.

P.P.S
```
function f( arg1, arg2, arg3 ) {
  const obj = {arg1, arg2};
  const obj2 = {arg3};
  //...
}
```
You obv could do that, but there are avoidable repetitions:
```
function f( obj.arg1, obj.arg2, obj2.arg3 ) {
  //...
}
```

And maybe something like:
```
function f( obj.{arg1, arg2}, obj2.arg3 ) {
  //...
}
```
could be faster :P

andrysimo1997 at gmail.com (2018-11-29T08:33:09.747Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.
\
\
P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.

P.P.S
```
function f( arg1, arg2, arg3 ) {
  const obj = {arg1, arg2};
  const obj2 = {arg3};
  //...
}
```
You obv could do that, but there are avoidable repetitions:
```
function f( obj.arg1, obj.arg2, obj2.arg3 ) {
  //...
}
```

andrysimo1997 at gmail.com (2018-11-29T08:31:18.574Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.
\
\
P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.




andrysimo1997 at gmail.com (2018-11-29T08:28:41.105Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.
\
\
P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.





P.P.S
```
function f( arg1, arg2, arg3 ) {
  const obj = {};
  const obj2 = {};
  ({ arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 } = {arg1, arg2, arg3 })
}
```
You could do that, but there is an object creation that I'd like to avoid and the syntax is not clear IMHO compared to:
```
function f( obj.arg1, obj.arg2, obj2.arg3 ) {
  //...
}
```
andrysimo1997 at gmail.com (2018-11-29T08:27:13.370Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.
\
\
P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.





P.P.S
```
function f( arg1, arg2, arg3 ) {
  const obj = {};
  const obj2 = {};
  ({ arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 } = {arg1, arg2, arg3 })
}
```
You could do that, but there is an object creation that I'd like to avoid and the syntax is not clear IMHO.
andrysimo1997 at gmail.com (2018-11-29T08:26:55.610Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.
&nbsp; &nbsp; 
P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.





P.P.S
```
function f( arg1, arg2, arg3 ) {
  const obj = {};
  const obj2 = {};
  ({ arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 } = {arg1, arg2, arg3 })
}
```
You could do that, but there is an object creation that I'd like to avoid and the syntax is not clear IMHO.
andrysimo1997 at gmail.com (2018-11-29T08:25:54.456Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.





P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.





P.P.S
```
function f( arg1, arg2, arg3 ) {
  const obj = {};
  const obj2 = {};
  ({ arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 } = {arg1, arg2, arg3 })
}
```
You could do that, but there is an object creation that I'd like to avoid and the syntax is not clear IMHO.
andrysimo1997 at gmail.com (2018-11-29T08:25:23.707Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.



P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.



P.P.S
```
function f( arg1, arg2, arg3 ) {
const obj = {};
const obj2 = {};
({ arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 } = {arg1, arg2, arg3 }) }
```
You could do that, but there is an object creation that I'd like to avoid and the syntax is not clear IMHO.
andrysimo1997 at gmail.com (2018-11-29T08:25:04.080Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.


P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function f ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.

P.P.S
```
function f( arg1, arg2, arg3 ) {
const obj = {};
const obj2 = {};
({ arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 } = {arg1, arg2, arg3 }) }
```
You could do that, but there is an object creation that I'd like to avoid and the syntax is not clear IMHO.
andrysimo1997 at gmail.com (2018-11-29T08:05:34.361Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if you want to gather them into an obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.


P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function a ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.

andrysimo1997 at gmail.com (2018-11-29T08:05:01.369Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```
f(arg1, arg2, arg3);
```

you could do like that to store them into an array:

```
function f(...args){

/* code */

}
```

but something like that won't work if u want gather them into a obj:

```
function f({...obj}){
/* code */
}
```

My proposal could solve this problem.


P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```
f( { arg1, arg2, arg3 } );
```
to make that work:

```
function f({...obj}){
/* code */
}
```
you cannot do something like that directly:

```
function a ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {
 // ...
}
```

My proposal theoretically could solve this "problem" too.

andrysimo1997 at gmail.com (2018-11-29T08:03:16.393Z)
Thanks for partecipating to this discussion and for your opinions on my
proposal. I cannot reply to each one of you now, but I'd like to receive
feedback also on the Further Ideas section. Maybe you'll find something
interesting.

In JS there is no way (please correct me if you find the way) to gather all
arguments directly in an object (without passing directly an object obv)
like you can easily do with an array.

So, to mantain this way to pass the arguments:

```

f(arg1, arg2, arg3);

```

you could do like that to store them into an array:

```

function f(...args){

/* code */

}

```

but something like that won't work if u want gather them into a obj:

``

function f({...obj}){

/* code */

}

```

My proposal could solve this problem.


P.S.

Though you pass an object created on the fly (and this is wath I'd like to
avoid):

```

f( { arg1, arg2, arg3 } );

```
to make that work:

``

function f({...obj}){

/* code */

}

```
you cannot do something like that directly:

```

function a ( { arg1: obj.arg1, arg2: obj2.arg2, arg3: obj2.arg3 }) {}

```
My proposal theoretically could solve this "problem" too.

Il giorno gio 29 nov 2018 alle ore 00:59 Ron Buckton <
Ron.Buckton at microsoft.com> ha scritto: