Hosting .fsx scripts inside larger applications

筅森魡賤 提交于 2019-12-23 10:49:34

问题


I want to expose my F# libraries as a scriptable tool for data manipulation.

Optimally, I want this scripting facility to not require a full F# install with fsi and so on.

Is there a way to link into the FSI libraries to execute scripts from F# code? My google-fu is failing me on this one, and the F# sources for fsi are a bit tangled.


回答1:


No, there's no hosting API for F# interactive sessions. fsi.exe itself is factored into a lightweight client process that handles the interaction, and a background server process that does the heavy lifting. (The server process is built atop the F# compiler DLLs, which is why you need a full install of F#, and not just the F# runtime redist. BTW, exposing an API for this is a somewhat common request and something the F# team will consider for a future release.)

That said, if clients do have a full install of F#, then you can always just ship some scripts (.fsx files) clients can #load, or libraries (.dll files) that clients can #r to start off their interactive fsi sessions. This is definitely a good mode for using F# interactive for data manipulation and exploration.



来源:https://stackoverflow.com/questions/2223766/hosting-fsx-scripts-inside-larger-applications

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