Subj : Re: outer visibility of nested functions To : =?ISO-8859-1?Q?Georg_Maa=DF?= From : Brendan Eich Date : Sun Jan 11 2004 10:23 pm Georg Maaß wrote: > So calling A allways created the function property A.B. Now with the > extension the nested function B is no longer immune against > destruction. If the user assigns something to A.B, calling A results > in an error or a differnent behaviour when B is called, when the > assigned stuff is also a function. This gives the user the power to > override accidently or with criminal energy the intension of the > implementor of A. I don't see that: js> function A() {function B(){print(this.name)}B()} js> A() 1: strict warning: reference to undefined property this.name undefined js> A.B() A js> A.B='boom' boom js> A.B() 5: TypeError: A.B is not a function js> A() 1: strict warning: reference to undefined property this.name undefined js> >> See the XXX comments at >> http://lxr.mozilla.org/mozilla/source/js/src/jsparse.c#871 (among >> other related XXX comments in the source). > > > For performance reasons this may be the default. But to protect the > inner function also the unpolluted tradition at least as option is > desirable. This switching should be done in a way that does not harm NN4. The compiler depends only while compiling, and it has just created both outer and inner functions, so there is no need to worry about criminals reseting A.B. As for the pollution of A's scope with a 'B' property, can you tell me again why it matters for NN4? /be .