[bitc-dev] OCaml syntax question

Jonathan S. Shapiro shap at eros-os.com
Thu Mar 5 09:17:46 EST 2009

Let me start over. The issue is that the following input to ocaml
produces 3 when it should produce an unbound reference error (x should
be unbound in "x + 2").

  # let x = 1 in x; let y = x + 2 in y;;
  - : int = 3

The problem is that the *following* expression is equivalent and
*terribly* confusing:

  # let x = 1 in begin x end; let y = x + 2 in y;;
  - : int = 3

The desired behavior can apparently be obtained only with begin/end or

  # (let x = 1 in x); let y = x + 2 in y;;
  Unbound value x

There are many examples even in the ocaml reference manual that are
indented incorrectly w.r.t. the actual binding rules. The sheer number
of these errors in the document strongly argues that scoping forms
should have a syntactic end marker. It might be okay if that turns out
to be indentation, but it needs to be something.

This is really too bad. It might have been pleasant for BitC to be a
dialect of OCaml.


More information about the bitc-dev mailing list