jastrachan | 25 Jun 09:01 2004

Re: Re: GroovyClassLoader Question

On 25 Jun 2004, at 01:24, Rob Giardina wrote:
> This is a difficult JVM restriction. In another context, I would argue
> that this is the single biggest limitation against interesting
> dynamic/symbolic programming patterns in Java.
> One of the most elegant work-arounds for this restriction is to
> introduce a layer of indirection such that the scriptName maps to an
> arbitrary generated classname.

Or just have an indirection between the scriptName to the ClassLoader 
which loaded it. Then at any time you can ditch the ClassLoader, reload 
the script in a new ClassLoader and hey presto you've reloaded it.

This is how the GroovyScriptEngine works...


which is used by the Groovlet engine to auto-reload scripts when 
they've changed. We should integrate this feature into the GroovyShell 
and elsewhere to allow this feature to be used in other places too.