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

OCaml shebang syntax error #5363

Closed
vicuna opened this issue Sep 29, 2011 · 1 comment
Closed

OCaml shebang syntax error #5363

vicuna opened this issue Sep 29, 2011 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Sep 29, 2011

Original bug ID: 5363
Reporter: mcandre
Assigned to: @protz
Status: closed (set by @xavierleroy on 2013-08-31T10:44:02Z)
Resolution: won't fix
Priority: normal
Severity: minor
Version: 3.12.0
Category: ~DO NOT USE (was: OCaml general)

Bug description

$ cat hello.ml
#!/usr/bin/env ocamlrun ocaml

let rec main = print_string "Hello World!\n"

$ ./hello.ml
Hello World!

$ ocaml hello.ml
Hello World!

$ ocamlc -o hello hello.ml
File "hello.ml", line 1, characters 0-1:
Error: Syntax error

$ ocamlopt -o hello hello.ml
File "hello.ml", line 1, characters 0-1:
Error: Syntax error

Similar to Erlang, OCaml permits shebangs in scripted mode, but borks in compiled mode. Please instruct the ocamlc and ocamlopt compilers to ignore shebangs.

@vicuna
Copy link
Author

vicuna commented Dec 21, 2011

Comment author: @protz

Hi,

That definitely seems wrong to me. Either you're developing a shell script, or you're writing a compiled program. The tasks achieved by the two styles are so different that I'm having a hard time seeing why you're switching back-and-forth between interpreted and compiled.

If you're just testing some features, why don't you just run ocaml hello.ml inside a terminal?

Cheers,

jonathan

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

1 participant