sorry, Kangax for the delay in getting back to you. My computer turned
off before I could click send last night.
Of course, we can return named function.
What I'd want to avoid, however, (for measurable[1] performance hit
_every time the function is called_) is multiple closures.
So we should be avoiding the following construct:
(function() {
var index = 1;
return (function() {
if (SOME_FEATURE_TEST) {
return function namedFunc() { return index }
}
return function namedFunc2() { return index + 1 }
})();
})()
[1]
http://blog.zenbe.com/2008/11/07/jslitmus-a-tool-for-testing-javascript-performance/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---