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

Anomalous syntax error #6570

Closed
vicuna opened this issue Sep 18, 2014 · 1 comment
Closed

Anomalous syntax error #6570

vicuna opened this issue Sep 18, 2014 · 1 comment
Assignees

Comments

@vicuna
Copy link

vicuna commented Sep 18, 2014

Original bug ID: 6570
Reporter: ftc
Assigned to: @garrigue
Status: closed (set by @garrigue on 2014-09-19T01:24:04Z)
Resolution: not a bug
Priority: normal
Severity: minor
OS: OSx
OS Version: 10.9.4
Version: 4.01.0
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues

Bug description

The following two lines of code seem to produce a syntax error when I wouldn't expect them to:

"
type foo = {a : string; b : int;}
Format.printf "hi";;
"

Steps to reproduce

Put two lines into a text file and run either ocaml or ocamlc on it.

Additional information

Easy fix for anyone looking for it.

type foo = {a : string; b : int;}

let _ =
Format.printf "hi";;

@vicuna
Copy link
Author

vicuna commented Sep 19, 2014

Comment author: @garrigue

In order to separate two phrases, you should use a double semicolon.

type foo = {a : string; b : int;};;
Format.printf "hi";;

It is allowed to omit this semicolon, but only if the next phrase
is a definition, starting with a keyword such as let, type, class,
module...
This does not apply to expressions, which must always be preceded
by a double semicolon.

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

2 participants