5 ms·
Do we just link to random commits now? I have no idea what arrow functions are or why it would even matter to half the people who visit this site. edit: after
by feld 11y ago
Do we just link to random commits now? I have no idea what arrow functions are or why it would even matter to half the people who visit this site.
edit: after following 4 links I finally found the bug report about it
https://code.google.com/p/v8/issues/detail?id=2700 https://code.google.com/p/v8/issues/detail?id=2700
- rubiquity 11y agoThen it seems like the perfect opportunity for you to learn something new and stretch your mind a little.
- JeremyBanks 11y agohttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- bsimpson 11y agoArrow functions are one of the improvements from JS Harmony (which was ratified last night). This commit moves them from "behind the experimental flag" to "shipping by default" in Chromium. It's a pretty big deal to people who write JS for a living.
- feld 11y agothat's what the synopsis of the post should have been, thanks
- towelguy 11y agoThey are a compact way to write anonymous functions in Javascript, so instead of var square = function (a) { return a * a;} You can write: var square = a => a * a;
- eueueu 11y agoSo basically, a useless hipster fashion lead fluffy syntax change, which mainly makes code harder to read, and makes typos more common. // foo takes a function, and a boolean. // foo(a=>7, a>=2); Really? That's easy to read is it? Eugh count me out.
- gfodor 11y agoYou are trolling, but arrow functions (unlike those defined with the function keyword) also bind this to that of the enclosing scope. The results in more intuitive behavior in most cases and less explicit bindings.
- eueueu 11y agoshrug it's still just code. It still does exactly the same thing as previous javascript code. Syntax changes are pretty boring IMHO, and as I said personally, I find this one much harder to read, more prone to errors, typos and confusion.
- kuschku 11y agoYes, but if you write a few thousand of those arrow functions, you will hate the useless function (a) { return b; } stuff, too.
- eueueu 11y agoIf you're writing a few thousand functions, you're doing something very wrong. It's like when languages make threads easy to create - and then programmers go away and use threads for everything! Maybe some verbosity is a good thing because it makes programmers think about whether they really want to do something a few thousand times.
- adrianpike 11y agoJavascript is a functional language. You _should_ be writing many functions, possibly thousands in a large codebase.
- gloriousduke 11y agoUsing arrow functions also lexically binds the this value in the anonymous function, an important change for many. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- teraflop 11y agoYour link goes to the same page as this post. Was it changed at some point?
- feld 11y agomust have, because it was going directly to the commit which didn't have any useful information.