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
Yotam Barnoy edited this page May 24, 2016
·
1 revision
OCaml Syntax
Inspired by Reason, this is an attempt to improve OCaml syntax without removing the `OCaml-ness' of the language.
if...end
One of the problems with the current syntax is that semicolons cause parsing ambiguity at the end of if expressions. This can cause bugs, especially in imperative code. You start off by having
if x=3
then do_this ();
Later on, you go back and change it to
if x=3
then do_this (); do_that ()
Except that the then expression only covers the first statement and not the second one, which always runs. Eventually, you need to make almost every if expression into