<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-5274051535398117366.post2298722330528967331..comments</id><updated>2009-03-05T05:03:34.004-08:00</updated><title type='text'>Comments on NonBlocking.io - Malte Ubl's Asynchronous Identity Disorder: Closures VS. Properties / arguments.callee is expe...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.nonblocking.io/feeds/2298722330528967331/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274051535398117366/2298722330528967331/comments/default'/><link rel='alternate' type='text/html' href='http://www.nonblocking.io/2009/03/closures-vs-properties-argumentscallee.html'/><author><name>Malte</name><uri>http://www.blogger.com/profile/14948805318873322781</uri><email>malte.ubl@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5274051535398117366.post-6380111336486789120</id><published>2009-03-05T05:03:34.004-08:00</published><updated>2009-03-05T05:03:34.004-08:00</updated><title type='text'>hallo Malte,sorry for disappointing you; unfortuna...</title><content type='html'>hallo Malte,&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;sorry for disappointing you; unfortunately, and once again due to msie,&lt;BR/&gt;this is not a solution ones code should last on - pasting the following&lt;BR/&gt;example into &lt;A HREF="http://jconsole.com/" REL="nofollow"&gt;jconsole.com&lt;/A&gt; will clearly point out the differences between&lt;BR/&gt;microsofts implementation and the ones of all other major browser brands.&lt;BR/&gt;&lt;BR/&gt;but even if dropping msie, one should be aware of the functions name-&lt;BR/&gt;scoping as can be comprehended with the 3 different occurences of [foo]:&lt;BR/&gt;&lt;BR/&gt;the [foo] labeled function expression referenced to [bar] will not be&lt;BR/&gt;able to refer to any other [foo] labeled/referenced function - though&lt;BR/&gt;using this approach of labeling function expressions might make one&lt;BR/&gt;getting stuck to a pretty strict naming-policy, loosing the more&lt;BR/&gt;liberal ability of recycling/reusing variable names.&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;example:&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;function foo () {&lt;BR/&gt;&lt;BR/&gt;  print("global [foo]");&lt;BR/&gt;}&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;(function () {&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;  function foo () {&lt;BR/&gt;&lt;BR/&gt;    print("[foo] embedded into an anonymus application context");&lt;BR/&gt;    print("\n");&lt;BR/&gt;  }&lt;BR/&gt;  var bar = (function foo () {&lt;BR/&gt;&lt;BR/&gt;    print("(foo === arguments.callee) ? " + (foo === arguments.callee));&lt;BR/&gt;    print("(arguments.callee === bar) ? " + (arguments.callee === bar));&lt;BR/&gt;    print("(foo === bar) ? " + (foo === bar));&lt;BR/&gt;    print("\n");&lt;BR/&gt;&lt;BR/&gt;    print(foo);&lt;BR/&gt;    print("\n");&lt;BR/&gt;&lt;BR/&gt;  //foo(); DON'T - NEVER EVER&lt;BR/&gt;&lt;BR/&gt;    print(window.foo);&lt;BR/&gt;    print("\n");&lt;BR/&gt;  });&lt;BR/&gt;  var baz = (function biz () {&lt;BR/&gt;&lt;BR/&gt;    print("(biz === arguments.callee) ? " + (biz === arguments.callee));&lt;BR/&gt;    print("(arguments.callee === baz) ? " + (arguments.callee === baz));&lt;BR/&gt;    print("(biz === baz) ? " + (biz === baz));&lt;BR/&gt;    print("\n");&lt;BR/&gt;  });&lt;BR/&gt;&lt;BR/&gt;  baz();&lt;BR/&gt;&lt;BR/&gt;  bar();&lt;BR/&gt;  foo(); // the embedded and not the [foo] labeled one function expression.&lt;BR/&gt;&lt;BR/&gt;  window.foo();&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;})();</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274051535398117366/2298722330528967331/comments/default/6380111336486789120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274051535398117366/2298722330528967331/comments/default/6380111336486789120'/><link rel='alternate' type='text/html' href='http://www.nonblocking.io/2009/03/closures-vs-properties-argumentscallee.html?showComment=1236258214004#c6380111336486789120' title=''/><author><name>peterS.</name><uri>http://www.blogger.com/profile/05339684479120637485</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.nonblocking.io/2009/03/closures-vs-properties-argumentscallee.html' ref='tag:blogger.com,1999:blog-5274051535398117366.post-2298722330528967331' source='http://www.blogger.com/feeds/5274051535398117366/posts/default/2298722330528967331' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5274051535398117366.post-3880676217874802201</id><published>2009-03-04T23:26:12.441-08:00</published><updated>2009-03-04T23:26:12.441-08:00</updated><title type='text'>Very interesting! I'm "naming" "anonymous" functio...</title><content type='html'>Very interesting! I'm "naming" "anonymous" functions all the time to get better stck traces but I didn't know that the name could be used inside the function.&lt;BR/&gt;&lt;BR/&gt;Thanks, I'll probably use this idiom a lot in the future.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274051535398117366/2298722330528967331/comments/default/3880676217874802201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274051535398117366/2298722330528967331/comments/default/3880676217874802201'/><link rel='alternate' type='text/html' href='http://www.nonblocking.io/2009/03/closures-vs-properties-argumentscallee.html?showComment=1236237972441#c3880676217874802201' title=''/><author><name>Malte</name><uri>http://www.blogger.com/profile/14948805318873322781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00760037520891382744'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.nonblocking.io/2009/03/closures-vs-properties-argumentscallee.html' ref='tag:blogger.com,1999:blog-5274051535398117366.post-2298722330528967331' source='http://www.blogger.com/feeds/5274051535398117366/posts/default/2298722330528967331' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5274051535398117366.post-8178307037375612969</id><published>2009-03-04T20:42:14.164-08:00</published><updated>2009-03-04T20:42:14.164-08:00</updated><title type='text'>Indeed arguments.callee is expensive because it re...</title><content type='html'>Indeed arguments.callee is expensive because it requires walking the stack, but just referencing the arguments object takes quite a large amount of time, in Nitro and V8 decisions are made base on whether the arguments object is referenced in code, and referencing the arguments object (at least for stack introspection) will cause TraceMonkey to abort (can't inline code that expects a callframe).&lt;BR/&gt;&lt;BR/&gt;You're right that you are far better off to just reference the function, happily JS does allow named function expressions, eg.&lt;BR/&gt;&lt;BR/&gt;var myFunction = function foo() { foo() }&lt;BR/&gt;&lt;BR/&gt;will recurse infinitely, better yet the name 'foo' is not injected into the parent scope, and is immutable, so allowing (technically) a large number of optimisations to be performed.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274051535398117366/2298722330528967331/comments/default/8178307037375612969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274051535398117366/2298722330528967331/comments/default/8178307037375612969'/><link rel='alternate' type='text/html' href='http://www.nonblocking.io/2009/03/closures-vs-properties-argumentscallee.html?showComment=1236228134164#c8178307037375612969' title=''/><author><name>Oliver</name><uri>http://www.blogger.com/profile/10773264982536568222</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.nonblocking.io/2009/03/closures-vs-properties-argumentscallee.html' ref='tag:blogger.com,1999:blog-5274051535398117366.post-2298722330528967331' source='http://www.blogger.com/feeds/5274051535398117366/posts/default/2298722330528967331' type='text/html'/></entry></feed>