Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FsiEvaluationSession arguments #420

Closed
jamesjrg opened this issue Sep 17, 2015 · 2 comments
Closed

FsiEvaluationSession arguments #420

jamesjrg opened this issue Sep 17, 2015 · 2 comments

Comments

@jamesjrg
Copy link

The documentation for embedding F# interactive suggests you set up the session like this:

let argv = [| "C:\\fsi.exe" |]
let allArgs = Array.append argv [|"--noninteractive"|]

let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration()
let fsiSession = FsiEvaluationSession.Create(fsiConfig, allArgs, inStream, outStream, errStream)  

Some questions:

  1. the path to fsi.exe is ignored, indeed the path argument can seemingly be omitted altogether and I found a post on StackOverflow from someone saying the same thing. However looking through the code I found the line
ParseCompilerOptions (collect, fsiCompilerOptions, List.tail (PostProcessCompilerArgs abbrevArgs argv))

so does that mean that if you do not include a dummy fsi.exe argument then the List.tail call will throw away the first of your real arguments? Is the purpose of the first argument soley as a sacrificial victim for the call to List.tail?

  1. Looking in the code the "--noninteractive" flag gets mapped to a property that determines whether a background thread is started to watch console input and/or stdin. Is the idea that people might make their own fsi based console? Naively it seems like noninteractive should be the default, because I would have thought most users of F# compiler services do not want to start a background thread watching stdin when evaluating scripts in their host application?
@dsyme
Copy link
Contributor

dsyme commented Sep 17, 2015

(1) - Yes. It's somewhat historical. I don't think it's particularly worth changing now though?

(2) - Yes, that would be better. The code was carefully extracted where most console-related parts went to the Fsi sample, but this remains.

@jamesjrg
Copy link
Author

  1. I'm not sure if it is possible to change it now without breaking backwards compatibility. However it is rather confusing, and it may be that people omit this first parameter and then inadvertantly their first real argument will be ignored.

  2. I could create a PR which just sets the default of interactive mode to false? Or maybe it would now be better to just leave things as they are now. And if it is changed then there might need to be a new flag to enable the background thread in case someone does want it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants