|
Relates :
|
Many existing scripts, especially node modules, use 'const' and so fail on Nashorn. As far as I can tell, a simple string replace with 'var' works just fine, but obviously Nashorn can do this much more effectively.
A new Options argument (even undocumented) would be perfect, e.g.
nashorn.option.const.as.var = {
name="--const-as-var",
is_undocumented=true,
desc="Replace 'const' with 'var'.",
type=Boolean
}
FWIW, our use case would pass it via NashornScriptEngineFactory.getScriptEngine().
|