Those spellings don't help when trying to visually parse a bunch of code which already largely consists of dense punctuation, though, IMO.
On Wednesday, 10 August 2016, Tab Atkins Jr. <[email protected]> wrote: > On Wed, Aug 10, 2016 at 7:25 AM, Eli Perelman <[email protected] > <javascript:;>> wrote: > > Now obviously it would be trivial for me to declare these constants in > > userland code like I already do, e.g. `const NOOP = () => {}`, but in > > projects where it's needed in several files, I'll have to put that in a > > module or re-declare everywhere. This is not a huge inconvenience but > > something that could easily allocated for in the language. > > Mark's argument (which I agree with) is that `x=>x` and `()=>{}` are > good *spellings* of "identity function" and "noop function". It's > immediately obvious what they do; `obj.doCallback(()=>{})` is about as > easy to understand as `obj.doCallback(Function.noop)`. The ID > function is even simpler - `obj.map(x=>x)` reads *extremely* well to > me, equal or better than `obj.map(Function.id)`. If we were to reserve > "id" and "noop" as bare global variables, I might agree that those > were even better, but that's clearly out of the question. > > ~TJ > _______________________________________________ > es-discuss mailing list > [email protected] <javascript:;> > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

