Subj : Re: Big problem, please help... To : Cunac From : Brendan Eich Date : Fri Nov 14 2003 10:25 am Cunac wrote: >>Are you using JSOPTION_VAROBJFIX? See jsapi.h. Are you making a the >>parent of b? I'm guessing you are, but please confirm. I shouldn't >>guess so much ("*I never guess: it is an appalling habit, destructive to >>the logical faculty." - S. Holmes).* >> >> > >Yes, a is parent of b. Problem is that variable is always created in topmost >(root) object instead of in one from where I am executing script, with or >without JSOPTION_VAROBJFIX option set. > > > Not quite: with JSOPTION_VAROBJFIX, both explicitly declared global variables (var x) and implicit ones (x = 42 where no x exists yet in the scope chain) both go in the last object on the parent-linked scope chain. Without that option, explicit globals go in the first object on the scope chain, while implicit globals go on the last. What you want (both explicitly and implicitly declared globals go in the first object on the scope chain) is nowhere specified in ECMA-262. Why do you think you want such a thing? /be .