以编程方式启动 Scala REPL? [英] Launch Scala REPL programmatically?

查看:37
本文介绍了以编程方式启动 Scala REPL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从命令行启动一个 Scala Swing 应用程序,然后在应用程序启动后,放入 Scala REPL 用作控制界面.

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.

理想情况下,我还想预先绑定一些变量名称.对 REPL 使用 Java2D 终端模拟器更好,但我找不到任何合适的东西.

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.

Scala REPL 有公共 API 吗?

Does the Scala REPL have a public API?

推荐答案

您可能会问同样的问题,如 这个问题,是吗?您还可以做其他事情.有一种方法可以只用代码调用 REPL,然后得到答复,这取决于您想要什么,这可能更合适.如果这就是你想要的,只需澄清它,我会研究它.

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.

对于Java2D终端,我觉得用ConsolesetInsetOutsetErr,但我可能弄错了.您可能想看看在环境中嵌入 REPL 的其他一些工作是如何做的.我认为至少有三个,但快速搜索仅基于 Kojo在 Netbeans 上.

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.

这篇关于以编程方式启动 Scala REPL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆