帮助嵌入 FSI
从这里开始 - 嵌入 F# 交互 - 我一直在尝试将 FSI 嵌入到我的应用程序中。
然而,我从 StandardOutput 得到了奇怪的东西。
例如,在标准 FSI 中,如果我发送这个:
let a = 3;;
我会得到这个:(
[empty line here]
val a : int = 3
[empty line here]
> |
用 Pipe 代表输入位置)
但是如果我发送 let a = 3;;
到 StandardInput,我会得到这个标准输出:
>
val a : int = 3
|
还有其他人尝试过吗?我做错了什么吗?如果没有,有什么办法可以解决这个问题吗?到目前为止我尝试过的所有事情都不起作用,在我尝试我能想到的“更糟糕”的事情之前(发送内容后设置计时器,在超时时添加>我自己),我想知道是否有是一个更好的方法!
Starting here - Embedding F# interactive - I've been trying to embed FSI in my application.
However, I'm getting weird stuff back from StandardOutput.
for example, in standard FSI, if I send this:
let a = 3;;
I get this back:
[empty line here]
val a : int = 3
[empty line here]
> |
(with Pipe representing the input position)
But if I send let a = 3;;
to StandardInput, I get this back on StandardOutput:
>
val a : int = 3
|
Has anyone else tried this? Is there something I'm doing wrong, and if not is there any way to work around this? None of the things I've tried so far work, and before I try the 'worse' thing I can think of (set a timer after sending stuff, add the > myself on timeout), I'd like to know if there is a better way!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嵌入 F# Interactive 时,Visual Studio 使用
--fsi-server:
参数。据我所知,这做了两件事:
更改输出的打印方式(而不是打印
>
,而是在单独的文件上打印SERVER-PROMPT>
行,因此应该更容易将其从输出中删除并在需要输入时检测状态)它还启动一些可用于停止执行的 .NET Remoting 通道F# Interactive 中的命令(例如,如果它遇到无限循环),它还可以提供一些完成信息。
MonoDevelop F# 插件中的 F# Interactive pad 使用该标志(请参阅源代码在 GitHub 上)。我认为它大部分工作正常,但我相信它有时会在输出中打印额外的
\n
。When embedding F# Interactive, Visual Studio uses the
--fsi-server:<some value>
parameter.As far as I know, this does two things:
Changes the way output is printed (instead of printing
>
, it printsSERVER-PROMPT>
on a separate line, so it should be easier to remove it from the output and detect state when input is expected)It also starts some .NET Remoting channel that you can use to stop execution of commands in F# Interactive (e.g. if it runs into an infinite loop) and it can also provide some completion information.
The F# Interactive pad in MonoDevelop F# plugin uses the flag (see source code on GitHub). I think it works mostly right, but I believe it sometimes prints additional
\n
in the output.