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
Multiple semicolons at the end of a line with no error mentioned #7727
Comments
Comment author: @Octachron This might warrant a clarification, but the current rule is that toplevel phrase are terminated by ";;"; and whatever comes after does not matter. In other words, if you are in a particularly interrogative mood, you can end your toplevel phrase with () ;; ??? |
Comment author: vanto Yes, this needs to be clarified. If this example above is calculated in Caml Light, the answer is:
It seems that the sequence of characters, after the double-semicolon, is taken into account by OCaml and this generates a loss of time and unnecessary calculation. I think it's better to stop writing after a double semicolon at the end of a line in the Toplevel. Are you sure it does not matter? |
Comment author: @Octachron Caml Light is obsolete and its quirks are not the object of this issue tracker. The behavior of OCaml's toplevel is consistent (and utop is available as a more user-friendly version of the toplevel). |
Comment author: vanto Caml light is quoted here for comparison and I think we had another approach to programming over thirty years ago. I think you are wrong and this little problem deserves our full attention. Here utop has nothing to do. |
Comment author: @Octachron A Github PR clarifying the behavior of the interactive mode would be welcome if you think that this behavior deserves your full attention. |
Comment author: @xavierleroy There are two orthogonal points here: 1- In OCaml, ";;" without anything before is parsed as a "do nothing" toplevel phrase. This works both in separate compilation (ocamlc, ocamlopt) and in interactive use (ocaml). 2- In interactive use only (ocaml), the rest of the line after the terminating ";;" is ignored. Both 1- and 2-, and especially 2-, are tolerances: they cause no harm, and might possibly be useful (?), but could also go away at any time, so we're not going to document them. Just don't use those tolerances and you'll be safe. |
Original bug ID: 7727
Reporter: vanto
Status: resolved (set by @xavierleroy on 2018-02-17T16:46:17Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 4.06.0
Category: toplevel
Has duplicate: #7728
Monitored by: @gasche
Bug description
Toplevel system 4.06. Reference manual 4.06 page 213.
It is written "A line is terminated by ;; (a double-semicolon)."
But we notice that we can write several semicolons at the end of a line and get the result without an error notification.
We can write several lines ending with several semicolons, there will never be any error mentioned.
Below, example in OCaml 4.06:
"zs";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;
45;;;
89;;;
1234;;;;
it seems that this continues since Caml Light release 0.74, except
that Caml Light only accepts three semicolons (;;;) without error.
But in the next line if we write another line, even correct, the error
is this time mentioned.
Below, example in Caml Light:
#"aa";;
#"bb";;;
#"cc";;
Entrée interactive:
The text was updated successfully, but these errors were encountered: