TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Arrow Functions Coming to Chrome 45

34 pointsby apaprockialmost 10 years ago

6 comments

0x0almost 10 years ago
Why is it that all new chrome features are usually announced on random blogs all over the place, while the official "chromereleasenotes" blogspot blog has almost never any useful information? There they all seem to talk about various minor security fixes in the stable channel posts, but almost never are new features highlighted. Is it really necessary to track the beta and canary release notes and svn logs to stay on top of things?
评论 #9760157 未加载
评论 #9763549 未加载
egeozcanalmost 10 years ago
Regarding the example at the end of the post, how does it even make sense to allow an anonymous arrow function be a &quot;paramater name&quot; (yes!) of another anonymous function? I guess the empty object becomes a destructuring parameter that doesn&#x27;t do anything but the function is confusing:<p><pre><code> ( ( {}, {}, ({},{})=&gt;({},{}) )=&gt; (({},{})=&gt;({},{}),{},{}) )({},{}) </code></pre> I can rewrite that to be more clear:<p><pre><code> &#x2F;&#x2F;(({},{})=&gt;({},{}),{},{}) evaluates to {} &#x2F;&#x2F;({},{}) evaluates to {} let fn = ({}, {}, ({},{})=&gt;{}) =&gt; {}; fn({},{}); </code></pre> This is just a syntax error, I guess (hope)?
评论 #9760417 未加载
moron4hirealmost 10 years ago
&gt; Relative to the other kind of function that is written like function (x) { return x * 2 }, arrow functions don&#x27;t define this or arguments in their bodies, instead capturing these values from the environment.<p>In the case of `this`, I can see why they did that: it is the right semantics and all of JavaScript should be this way. But I really think creating two different behaviors for what should all just be syntactic sugar around the same, ol&#x27; function values is long-term going to reveal itself as a mistake.<p>But that&#x27;s just `this`. I can&#x27;t for the life of me imagine why they also did this for `arguments`.
评论 #9760451 未加载
fenomasalmost 10 years ago
The author says using arrow functions won&#x27;t hurt performance, but I wonder if that means v8 knows how to optimize them?<p>Last I checked, using any ES6 syntax causes v8 to permanently deopt the containing function - even using let&#x2F;const to declare an unused variable that would get removed as dead code. It&#x27;ll be great once that starts changing..
评论 #9761509 未加载
homulillyalmost 10 years ago
I take it this means we&#x27;ll also get arrow functions enabled by default in IO.js shortly?
apalmeralmost 10 years ago
No Offense, but arrow functions and the &#x27;let&#x27; keyword in particular just seem like really bad ideas for javascript.
评论 #9760669 未加载
评论 #9760183 未加载
评论 #9760129 未加载