Launch Scala REPL programmatically?

こ雲淡風輕ζ 提交于 2019-12-09 15:18:18

问题


I would like to launch a Scala Swing application from the command line, then after the application is started, drop into the Scala REPL to use as a control interface.

Ideally I would also like to pre-bind some variable names. Even better would be using a Java2D terminal emulator for the REPL, but I couldn't find anything appropriate.

Does the Scala REPL have a public API?


回答1:


You are may be asking about the same thing, as this question, are you? There is other stuff you can do. There's a way to just call REPL with a code, and get an answer back, which, depending on what you want, may be more appropriate. If that's what you want, just clarify it and I'll research into it.

As for Java2D terminal, I think it is enough to use Console's setIn, setOut and setErr, but I might be mistaken. You might want to take a look at how some other efforts which embed REPL in the environment do. I think there are at least three of them, but a quick search only Kojo, which is based on Netbeans.



来源:https://stackoverflow.com/questions/2456868/launch-scala-repl-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!