Subj : Re: outer visibility of nested functions To : netscape.public.mozilla.jseng From : Martin Honnen Date : Sat Jan 10 2004 05:25 pm Georg Maaß wrote: > js> function A() > { > function B() > { > print(this.name); > } > B.name = 'B'; > } > js> A.name='A'; > A > js> this.name='global'; > global > js> A.B(); > A > js> > > > Why is B a property of A? Shouldn't there be a private scope of A > containing B? > > The expected behaviour of "A.B();" is: > > js> A.B(); > 11: TypeError: A.B is not a function > > But what I get is: > > js> A.B(); > A Rhino yields the TypeError on A.B() so Spidermonkey and Rhino are different here. As far as ECMAScript edition 3 is concerned there is (as far as I know) certainly nothing suggesting that inner functions need to be exposed as properties of the outer function but it is also hard to find anything that forbids that. -- Martin Honnen http://JavaScript.FAQTs.com/ .