Subj : Re: syntax check To : Igor Bukanov From : Brendan Eich Date : Sun Jan 16 2005 08:18 pm Igor Bukanov wrote: > Georg Maaß wrote: > >> ... Is Script also >> implemented in Rhino? > > > Yes, it is implemented in Rhino. > >> ... >> Which context does this script generated by the Script function use? > > > I assume you mean scope, not context, right? In Rhino instances of > Script use the top scope of the scope at then moment of script call so > script code can assume it has access to top or global variables. For > example, if you execute the following in Rhino shell: > > var a = 1; > > function f() > { > var a = 2; > var s = Script("a = 0"); > s(); > print(a); > } > > f(); > print(a); > > you should get > 2 > 0 > since code executed via s() does not have access to function scope. Who made up that rule? ;-) SpiderMonkey output for same script: 0 1 Why not use the activation as the scope chain head? /be .