the syntax let decorators ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

the syntax let decorators ?

郑宇光
do you like syntax like this

```
@inc
let a = 1;

function inc(value) {
  return value + 1;
}
```

I write a plugin to enable this syntax for test, [javascript let decorators](https://github.com/ukari/javascript-let-decorators)

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: the syntax let decorators ?

Andy Earnshaw-2
I don't like this syntax.  `let` can be used to declare multiple variables, so how does this work?

```
@inc
let a = 1,
    b = 2;
```

Does it only decorate the first, or does it decorate all?  Either way, I don't think it's flexible enough to be compatible with certain coding styles.  If it is ever going to work, the decorator should come before the variable name:

```
let @inc a = 1,
    @inc b = 2;
```

On Wed, 27 Dec 2017 at 10:48 郑宇光 <[hidden email]> wrote:
do you like syntax like this

```
@inc
let a = 1;

function inc(value) {
  return value + 1;
}
```

I write a plugin to enable this syntax for test, [javascript let decorators](https://github.com/ukari/javascript-let-decorators)
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: the syntax let decorators ?

郑宇光

2018-01-11 18:31 GMT+09:00 Andy Earnshaw <[hidden email]>:
I don't like this syntax.  `let` can be used to declare multiple variables, so how does this work?

```
@inc
let a = 1,
    b = 2;
```

Does it only decorate the first, or does it decorate all?  Either way, I don't think it's flexible enough to be compatible with certain coding styles.  If it is ever going to work, the decorator should come before the variable name:

```
let @inc a = 1,
    @inc b = 2;
```

On Wed, 27 Dec 2017 at 10:48 郑宇光 <[hidden email]> wrote:
do you like syntax like this

```
@inc
let a = 1;

function inc(value) {
  return value + 1;
}
```

I write a plugin to enable this syntax for test, [javascript let decorators](https://github.com/ukari/javascript-let-decorators)
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss