You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 222 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: John Max Skaller
Version: 3.00
OS: Linux
Submission from: proxy4.syd.pacific.net.au (203.27.69.94)
Notice that no ';;' is required after the 'open'
directive here.
My guess is that the parser, at the top level, will not
accept an expression after an 'open' directive;
but it does accept a let binding. An expression is accepted,
however, if the open directive is elided, this:
let map = List.map in ();;
works fine because there is no preceding 'open'.
In the failing examples shown, the parser actually reports an
error in the expression. However, in some of my production
code, it mysteriously reports an error where the missing
';;' is needed; that is, it reports an error in columns 0-1
of a blank line, where there is no text.
The text was updated successfully, but these errors were encountered:
My guess is that the parser, at the top level, will not
accept an expression after an 'open' directive;
but it does accept a let binding.
It's simpler than that, actually: the parser doesn't accept a
top-level expression unless preceded by ";;" or "let _ =". If
you're allergic to semicolons, you can use the latter.
In the failing examples shown, the parser actually reports an
error in the expression. However, in some of my production
code, it mysteriously reports an error where the missing
';;' is needed; that is, it reports an error in columns 0-1
of a blank line, where there is no text.
If you can send a piece of code exhibiting this behaviour, we'll be
happy to fix the problem and make it report the error in some sensible
place.
Original bug ID: 222
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: John Max Skaller
Version: 3.00
OS: Linux
Submission from: proxy4.syd.pacific.net.au (203.27.69.94)
The following works:
open List
;;
print_endline "x"
;;
Remove the first ';;' and it fails:
open List
print_endline "x"
;;
[root@pelican] ~/links/ot>ocamlc t.ml
File "t.ml", line 3, characters 0-13:
Syntax error
The following is OK:
open List
let map = map;;
Notice that no ';;' is required after the 'open'
directive here.
My guess is that the parser, at the top level, will not
accept an expression after an 'open' directive;
but it does accept a let binding. An expression is accepted,
however, if the open directive is elided, this:
let map = List.map in ();;
works fine because there is no preceding 'open'.
In the failing examples shown, the parser actually reports an
error in the expression. However, in some of my production
code, it mysteriously reports an error where the missing
';;' is needed; that is, it reports an error in columns 0-1
of a blank line, where there is no text.
The text was updated successfully, but these errors were encountered: