Repository navigation
Simplify FCS interaction code by using Yaaf.FSharp.Scripting. - #305
Conversation
|
Ok thats the message after this patch: It's not like super nice but definitely better than before. But still: I have no idea why it is working on windows :(. |
|
But yes after looking at this, bundling as proposed in #303 would help here as well... |
|
@tpetricek : I'm giving up on the FsLab/FCS issue, I guess there is code somewhere in FCS to consider currently loaded assemblies when resolving (compile) assemblies, but I couldn't find it. Maybe this is even just another FCS issue? We can work around this particular issue within FSharp.Formatting quite easily by just adding additional "#I" and "#r" statements not only for the currently executing, but for all assemblies we need. Or we consider this as by design (IE tell users of FSharp.Formatting that we expect our dependencies to live in the same folder as "FSharp.Formatting.dll"). |
|
Ah! Thanks a lot for looking into this, I think I now understand what's going on (looks like I did break something with a recent change :-( ...) I basically added the broken piece of code to avoid dependency on I think the safest option is just to eval some ugly inlined string with the definition of BTW: I used this to get better error info: http://fssnip.net/qF |
|
Well, this was definitely my mistake - after fixing this (I'll send a PR), we won't need to have all the libraries in the same folder, so perhaps that also reduces the urgency of #303 - but I think the discussion there is still valid and it is probably a good direction (but we can perhaps wait a bit more to see if other people have any thoughts on that...) |
This is really a PIA, that's one of the reason why I have extracted the scripting use case in https://github.com/matthid/Yaaf.FSharp.Scripting for a scripting API with all those little bugfixes like nice error messages (this PR) or fixing the Currently we have those fixes spread out in several locations:
To show two examples :)
Ah, so we don't actually need to load ourself into the interactive we are hosting? That should definitely fix this as well :) However I still feel like we should add this (or something similar), because it will give people using FSharp.Literate exactly the error message they would get when running in FSI.exe (and it will simplify our lives at well when people report errors or when we encounter them)
Oo never noticed this, thanks!
Yes to get feedback was exactly the intention of #303 ... |
|
Yaaf.FSharp.Scripting looks very nice! I would probably prefer to avoid another DLL dependency, but if we could import something like that as a few source files via Paket, that might be nice (and I suspect FAKE could do the same). The way I understand the F# Compiler Interactive Service thing is that:
Having all the tweaks in some file that we could reference via Paket would be nice (and we could send PR to FAKE to use it too.) It would be nice to add (3) to FAKE too - I could then get rid of my dirty workarounds for (2)... |
|
Very nice idea! I will try to refactor the features in easy to include source files!
Actually I experienced the reverse when working these things out in the past: https://github.com/fsharp/FSharp.Compiler.Service/blob/89d936ca760b790f7741a0bab9122002a792810c/src/fsharp/fsi/fsi.fs#L2705 The
The funny thing is we could do this in
https://github.com/fsharp/FSharp.Compiler.Service/blob/master/src/fsharp/fsi/fsi.fs#L2855 it literally uses Bah I hope at least some of that is correct :) . I'll report back once I have refactored the files. Edit: Removed wrong sentence. |
|
Uh, I think some of my "magic" is not working when included as script file :( |
Did you mean Ok done, I re-used this PR (the title is still true). |
|
Added another simplification. |
This also fixes some problems with the current implementation like missing "fsi" (noticed by tpetricek here: fsprojects/FSharp.Formatting#305)
…ot working on linux).
Use relative paths (because they should work as well).
|
OK finally everything seems to work as it should. A lot of commits but actually only a very few amount of changes to review (details in the edited start comment). |
Simplify FCS interaction code by using Yaaf.FSharp.Scripting.
|
I wanted to be sure that relative paths are still handled correctly, so I added a test for that and... everything worked perfectly :-) In fact, I think it is actually even redirecting the work to the |
|
Thanks for the testing and the release!
That was exactly the intention: Make F# scripting work as easily as possible without the need to care about all this FCS nuances/bugs/argument stuff. But something (which looks related to this change) is broken now :( , looking into it...
After noticing this I'm also wondering why
Thanks for this, I did some testing myself but I wasn't sure if everything works as it should when some advanced stuff is done with it :) Everything is done with reflection so it may be a bit slow, but I don't think anyone is calling the Btw FAKE does now also contain this, so you may be able to remove some workarounds you mentioned above (please report if something breaks) |
|
I think we could enable it for ProjectScaffold - can you send a PR there? We initially thought it was a bit experimental and perhaps we don't want to run things on people's machine when building docs :-) but I think it is mature and people expect this now... |
|
Yeah, but first I'll need figure out why something broke with the update... |
EDIT
As discussed below, this PR now references the source code of https://github.com/matthid/Yaaf.FSharp.Scripting and fixes several bugs:
FsiEvalutatorwe currently have the nasty side effect of changing the current directory, this will follow up with a vast number of different exceptions (depending on which paths are relative and which are full)At the same time the code is simplified.
Original (continuation of #303)
We cannot see the "real" error, because FSharp.Formatting is swallowing it...
For the FsLab issue:
The root cause seems to be in https://github.com/tpetricek/FSharp.Formatting/blob/master/src/FSharp.Literate/Evaluator.fs#L130 which pretty much expects all libraries to be available near FSharp.Literate.dll. As it is searching for compile-time assemblies, I'm now wondering why it is actually working on windows. I think we will know more when we have the exact error message...
While I'm looking for the exact error this can already run through the CI build in the mean time...