fable-compiler / repl

Fable online REPL
http://fable.io/repl
MIT License
64 stars 38 forks source link

User is forced now to explicit a module name #64

Closed alfonsogarciacaro closed 6 years ago

alfonsogarciacaro commented 6 years ago

Not a serious issue, but just to let you know, apparently now it's necessary to add a module name (e.g. module Sample) at the beginning of the file or the REPL will complain. My guess is this has to do with recent changes in @ncave FCS fork.

ncave commented 6 years ago

@alfonsogarciacaro Yes, I just reverted the default target change in FCS-Fable. Sorry about that.

alfonsogarciacaro commented 6 years ago

No worries, can it be easily changed for scripts? If it can't I guess it's not a big problem, we just need to make users aware of this :)

alfonsogarciacaro commented 6 years ago

@ncave I just noticed that also now when having a value at the end of the script without consuming it (printing, etc), there's a very misleading error message. Maybe it's related to the problem above?

image

ncave commented 6 years ago

@alfonsogarciacaro Did you push a new REPL bundle after I reverted the FCS default target (see above)? If not, you may have to.

alfonsogarciacaro commented 6 years ago

Thanks @ncave! I created the new bundle and now the first issue is fixe :tada: But still having problems with the second one (error if the last value is not consumed). Any ideas?

alfonsogarciacaro commented 6 years ago

It's actually not only the last value but any module action with unconsumed values.

ncave commented 6 years ago

@alfonsogarciacaro I'll take a look where it's happening.

alfonsogarciacaro commented 6 years ago

Thanks! I can try to reproduce with an unminified bundle and get a more descriptive error if that helps.

ncave commented 6 years ago

@alfonsogarciacaro No need, I can reproduce it even with dotnet. Here is the actual error printed here, if DEBUG is enabled:

Unable to cast object of type 'clo@1504[Microsoft.FSharp.Core.Unit,System.String,System.String]'
to type 'Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.FSharpFunc`2
[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.PrintfImpl+PrintfEnv`3 
[Microsoft.FSharp.Core.Unit,System.String,System.String]], 
Microsoft.FSharp.Core.FSharpFunc`2[System.String,System.String]]'.

when compiling this:

let f x = x * x
f 3

I'll see if I can pinpoint what's causing it.

alfonsogarciacaro commented 6 years ago

Awesome, super fast! It's not totally necessary to "fix" it, but if we could change the error message to something users could understand ("This value is being ignored" or similar) that'd be more than enough.

ncave commented 6 years ago

@alfonsogarciacaro Still looking into it, but in the mean time changing here from "test.fs" to "test.fsx" should fix it, at least in the REPL.

alfonsogarciacaro commented 6 years ago

It's working, thanks a lot!

alfonsogarciacaro commented 6 years ago

I'll close this for now, but please feel free to reopen if you want to keep it as a reminder for the other issue.

ncave commented 6 years ago

@alfonsogarciacaro The error above is now fixed here, please build a new REPL bundle with latest FCS-Fable. You can revert the file name change from .fsx to .fs, if you want to get the warning.