Re: Re: Since we're discussing arrow functions and syntax...
I'd check out the bind and pipe operators: https://github.com/tc39/proposal-bind-operator https://github.com/tc39/proposal-pipeline-operator But my problems are `=>` and `->` would really lead to some sadness. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss
Re: Since we're discussing arrow functions and syntax...
I was for it before ES6 and they told me it was "an arrow too far" however, object methods shortcuts are better than arrows and methods is the only place where you need `this` On Tue, Oct 24, 2017 at 2:34 PM, kai zhu wrote: > -1 > this is user-hostile to c++ programmers writing wasm / node-native > modules, when they context-switch c++ <-> javascript > > On 10/25/17, Michael Rosefield wrote: > > I like arrow functions, and sometimes the only reason I don't use them is > > because I need this-binding. > > > > So I, personally would like a variant that uses the CoffeeScript -> > syntax > > that is precisely like => except that it uses traditional this-binding. > The > > only 2 issues I can see are: > > > > * adding more syntax to the language > > * could the concise form bind this? Would, say `const foo = obj -> > > Object.assign(obj, this.bar)` work, if then used, say, as follows: `const > > baz = { bar: { /*whatever*/ } }; foo.call(baz, { /* something */ })` > > > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss
Re: Since we're discussing arrow functions and syntax...
-1 this is user-hostile to c++ programmers writing wasm / node-native modules, when they context-switch c++ <-> javascript On 10/25/17, Michael Rosefield wrote: > I like arrow functions, and sometimes the only reason I don't use them is > because I need this-binding. > > So I, personally would like a variant that uses the CoffeeScript -> syntax > that is precisely like => except that it uses traditional this-binding. The > only 2 issues I can see are: > > * adding more syntax to the language > * could the concise form bind this? Would, say `const foo = obj -> > Object.assign(obj, this.bar)` work, if then used, say, as follows: `const > baz = { bar: { /*whatever*/ } }; foo.call(baz, { /* something */ })` > ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss