-
Notifications
You must be signed in to change notification settings - Fork 301
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
Errors when using #load #435
Comments
Actually all your assumptions are correct. Fable's behaviour is indeed correct and in this case fsharpi just works in this case because it runs (and save into memory) every script when loading them. Also, as you point out, it's possible to use an extra |
When you say "more human friendly project file", do you mean https://blogs.msdn.microsoft.com/dotnet/2016/05/23/changes-to-project-json/ https://blogs.msdn.microsoft.com/dotnet/2016/07/15/net-core-roadmap/ |
No, sorry. It's another file format made by the F# community. But they asked me not to disclose details until things are closer to alpha release, so I cannot say much more at the moment 😕 |
That's fine, I understand. I was very disappointed when I heard that project.json was discontinued, so I'm glad that F# is considering an alternative to fsproj. P.S. Since this isn't a bug in Fable, I'm going to close this issue. |
Reopening because this is still an issue, and it's been decided for Fable to prefer |
From what I understand, when I don't know what Fable does, but it's definitely not depth-first. So in order to solve this issue (and increase compatibility with When encountering There are other ways of implementing this, but the important part is that it is top-to-bottom and depth-first. |
Hmm, I still think this is not a bug as it's according to F# specs. However, the load resolution by the F# compiler first takes all the In any case, please note this behaviour cannot be changed by Fable or Ionide but by the F# compiler itself, so we must be very careful that it doesn't affect other users. |
You're right, I'm not really sure how to go about this: should you or I file a new issue in the Actually, this looks similar: fsharp/fsharp-compiler-docs#587 Maybe it's already fixed in a new version...? |
I'll probably should just accept that |
Consider these three files:
When I run
fsharpi foo.fsx
it correctly prints30
and then20
But when I run
fable foo.fsx
it gives the following error:This seems wrong:
bar.fsx
uses#load "qux.fsx"
so it should have access to theQux
module.If I rearrange the
#load
infoo.fsx
so that it looks like this......then the problem goes away. But that makes it tricky to use nested
#load
, because you have to take into account the correct linear dependency order at every step.I had tried putting all of the
#load
in the root file (foo.fsx
), which works great for Fable. But when I'm editing thebar.fsx
file, Ionide thinks thatQux
isn't loaded (becausebar.fsx
doesn't have a#load "qux.fsx"
), so it throws all kinds of errors.Also, it seems like in
fsharpi
it actually evaluates thequx.fsx
file twice. So#load
is behaving like an#include
in C. I prefer Fable's approach where each module is loaded once, even though it's incompatible withfsharpi
It seems like there's a tension between the correctness of using
fsproj
and the convenience of usingfsx
. That's a real shame, because I findfsproj
to be a nightmare to use.Related information
The text was updated successfully, but these errors were encountered: