From 15fd51c9984fcadcfa83658ae0f01e4b3402c07f Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 11 Sep 2014 21:40:15 +0700 Subject: Minor style notes in the OCaml tutorial. --- ocaml.html.markdown | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ocaml.html.markdown b/ocaml.html.markdown index 5c236b1a..7f4e0a9d 100644 --- a/ocaml.html.markdown +++ b/ocaml.html.markdown @@ -59,11 +59,19 @@ written in curried form. (* Expressions can be separated by a double semicolon symbol, ";;". In many cases it's redundant, but in this tutorial we use it after - every expression for easy pasting into the interpreter shell. *) + every expression for easy pasting into the interpreter shell. + Unnecessary use of expression separators in source code files + is often considered to be a bad style. *) (* Variable and function declarations use "let" keyword. *) let x = 10 ;; +(* OCaml allows single quote characters in identifiers. + Single quote doesn't have a special meaning in this case, it's often used + in cases when in other languages one would use names like "foo_tmp". *) +let foo = 1 ;; +let foo' = foo * 2 ;; + (* Since OCaml compiler infers types automatically, you normally don't need to specify argument types explicitly. However, you can do it if you want or need to. *) let inc_int (x: int) = x + 1 ;; -- cgit v1.2.3