jastrachan | 23 Apr 08:22 2004

Re: Calling scripts within scripts

On 22 Apr 2004, at 22:04, Richard Monson-Haefel wrote:
>> We don't support exposing a class's internal variable scopes as the 
>> current context when evaluating execute.
>> You could try passing 'this' into the script.
>> shell = new GroovyShell()
>> shell.outer = this
>> shell.execute(new File("foo.groovy"))
> I'm not possitive about this, but I don't think there is an "execute" 
> method on GroovyShell. Maybe you meant "evaluate"?

You're quite right, my bad.

> Also, I find this contradicts an earlier comment where you said you 
> had added support for the following:
> execute(new File("foo.groovy"))
> In other words execute is like a global method or something. Maybe I'm 
> confused.

We added evaluate() as a helper method inside scripts. Though its only 
available inside scripts - its not a global function available 
anywhere. John brought up a case where he wanted to use evaluate inside 
a class method.