Subj : Re: outer visibility of nested functions To : =?ISO-8859-1?Q?Georg_Maa=DF?= From : Brendan Eich Date : Sat Jan 10 2004 09:15 am 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? A SpiderMonkey extension, very old, unlikely to change. > Shouldn't there be a private scope of A > containing B? There is, as needed (whenever A is activated). > > 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 That follows the usual this-binding rule: callee expression object reference base. /be > > .