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

Hello world no longer working in F#: The namespace or module 'Obj' is not defined #675

Closed
catalin-hritcu opened this issue Sep 11, 2016 · 5 comments

Comments

@catalin-hritcu
Copy link
Member

[hritcu@detained hello]$ make fs 
../../bin/fstar.exe   --odir out --codegen FSharp hello.fst
Extracting module FStar.PredicateExtensionality
Extracting module FStar.TSet
Extracting module FStar.Heap
Extracting module FStar.ST
Extracting module FStar.All
Extracting module Hello
Verifying module: Hello
All verification conditions discharged successfully
cp ../../bin/FSharp.PowerPack.dll out
fsharpc --mlcompatibility -r ../../bin/FSharp.PowerPack.dll --nowarn:0086 -o out/hello.exe ../../lib/fs/prims.fs ../../lib/fs/io.fs out/Hello.fs
F# Compiler for F# 4.1
Freely distributed under the Apache 2.0 Open Source License

/home/hritcu/Projects/fstar/pub/lib/fs/prims.fs(84,25): error FS0039: The namespace or module 'Obj' is not defined
make: *** [Makefile:44: fs] Error 1
@beurdouche
Copy link
Member

beurdouche commented Sep 11, 2016

Not surprising :(
I classified example, because it affects more than Hello World

@thinkyfish
Copy link

I can confirm this bug.

I managed a workaround by commenting out and changing the relevant lines in prims.fs:
(*let Obj.magic () = failwith "no magic"*)
let unsafe_coerce x = failwith "no magic"

Although I have no idea what consequences this would have.
Obj.magic doesn't seem to be used in any other .fs files and seems to be a hangover from ocaml.

@catalin-hritcu
Copy link
Member Author

catalin-hritcu commented Oct 23, 2016

@thinkyfish Thank you for the fix. I applied it, although it's to a file that we shouldn't be using in the first place. So I also changed examples/hello/Makefile to use ulib/fs/prims.fs instead of lib/fs/prims.fs.

It's depressing that we have 4(!) prims.fs versions lying around at various levels of obsoleteness:

./lib/fs/native_int/prims.fs
./lib/fs/prims.fs
./ulib/fs/native_int/prims.fs
./ulib/fs/prims.fs

I've also noticed that in the same examples/hello/Makefile file there are two other targets that don't work, although they are using OCaml not F#:

[hritcu@detained hello]$ make testseq
[...]
unrecognized option '--use_native_int'
[...]
Error: I/O error: out/FStar_Seq.ml: No such file or directory
[...]
[hritcu@detained hello]$ make bat_testseq                                                                                (git)-[catalin_private] 
../../bin/fstar.exe --use_native_int --odir out --codegen OCaml testseq.fst
unrecognized option '--use_native_int'
cp ../../ulib/ml/native_int/prims.ml ../../ulib/ml/FStar_IO.ml FStar_Seq.ml out
cp: cannot stat '../../ulib/ml/native_int/prims.ml': No such file or directory
cp: cannot stat 'FStar_Seq.ml': No such file or directory

@nikswamy @msprotz Does the feature these tests are supposed to illustrate still exist? If not let's remove them!

@nikswamy
Copy link
Collaborator

We should either make a concerted effort to fix and maintain the F# code generator, or else officially not support F# code generation any more. At the moment, it is in a sad, half-baked state.

@nikswamy
Copy link
Collaborator

@polubelova @prosecco : is supporting an F# backend something that you're also thinking about?

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

4 participants