Carsten Ziegeler wrote:

The compileScript method in the JavaScriptInterpreter looks like this:


public Script compileScript(Context cx,
Environment environment,
String fileName) throws Exception {
Source src = environment.resolveURI(fileName);



I'm wondering why here the environment is needed for resolving the source. A usual source resolver should do the trick as well, no? If we would use the source resolver we could release the source cleanly and we avoid the hacky dependency that the environment accidentally implements source resolver as well.



Actually, the whole flow stuff abuses the use or Environment, when it simply needs the object model. On my todo list is some refactoring to remove all uses of environment in the flow, unless someone else volunteers for it.


In the meantime, we can simply replace uses of the Environment by the real SourceResolver where needed.

BTW, regarding the forthcoming refactoring of Environment: is this "accidental" implementation of SourceResolver really needed?

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com




Reply via email to