Shorter syntax for arrow function assignment

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Oct 24 17:47:21 UTC 2017


> functions are already outmoded

I don't know where you come from but to me:

```js
// this ain't outmoded at all
const obj = {
  method() { return this === obj; }
};

// this ain't outmoded at all
class Any {
  method() { return this instanceof Any; }
}
```

And a module that provides mixins is definitively not outmoded at all
```js
export method() {
  return this !== undefined;
};
```

Omitting the arrow is everything but a syntax win here.

Regards




On Tue, Oct 24, 2017 at 2:32 PM, Brian Blakely <anewpage.media at gmail.com>
wrote:

> At current, sans an explicit assignment, the pragma `foo() {...}` should
> throw.
>
> On Tue, Oct 24, 2017 at 1:26 PM, dante federici <
> c.dante.federici at gmail.com> wrote:
>
>> Another annoying thing JS has to deal with is:
>> ```
>> // implicitly 'var'
>> someVar = 10;
>> ```
>>
>> So, something like:
>> ```
>> myFn() {
>> }
>> ```
>>
>> Would be considered as:
>> ```
>> var myFn = function() {
>> }
>> ```
>>
>> with what semantics exist now. Not best practices, but what is currently
>> interpreted in the language.
>>
>> I'd 100% agree that, as a shorthand, this is nice:
>> ```
>> myFn() { }
>> const myFn = () => {}
>> ```
>>
>> Which is what I mean. But I'm not the full implementation of JavaScript.
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171024/95d5ee11/attachment.html>


More information about the es-discuss mailing list