Currently, to use Scala as a scripting engine, one has to do:
import scala.tools.nsc.*; Interpreter n=new Interpreter(new Settings()); n.bind("label", "Int", new Integer(4)); n.interpret("println(2+label)"); // didn't event try to check success or error n.close();
It would be nice if one could do instead:
import javax.script.*; ScriptEngine e = new ScriptEngineManager().getEngineByName("scala"); e.getContext().setAttribute("label", new Integer(4), ScriptContext.ENGINE_SCOPE); try { engine.eval("println(2+label)"); } catch (ScriptException ex) { ex.printStackTrace(); }
Plus, as was pointed elsewhere, the compiler used in the background by the interpreter should not need a filesystem (for instance if scripting is to be used on handheld devices etc.)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4