Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't program in OCaML or any ML for that matter, but what's so gnarly about the syntax ?


One common critique is that in the toplevel (REPL) you must terminate your inputs by ;; and sometimes you will see code that puts ;; between function definitions too.

Also, nesting pattern matches is a bit ugly:

    match x with
    | Foo y ->
      match y with
      | Yes -> ok ()
      | No  -> not_ok ()
    | Bar z -> whatever()
does not work, it must be:

    match x with
    | Foo y ->
      begin match y with
      | Yes -> ok ()
      | No  -> not_ok ()
      end
    | Bar z -> whatever()
which is not a big deal but surprisingly easy to forget.

Some people would also really like to write

    let x = foo
    let y = bar
    x + y
but it has to be

    let x = foo in
    let y = bar in
    x + y
and those many "in"s accumulate.

A bunch of these things look a lot cleaner in Haskell. Although it does it by being indentation-sensitive, which other people love hating.


Nobody really cares about programming language syntax as long as the grammar is reasonably sane and the semantics are clear. Which is the case with OCaml.

The other criticisms are the ones worth attending.


Well, enough people cared about the syntax to make Reason...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: