What's wrong with the OCaml syntax? It's much more clean than say scala's one, it's indentation insensitive, and a' list feels more relevant than the list<'T>
What's wrong with the OCaml syntax? It's much more clean than say scala's one, it's indentation insensitive, and a' list feels more relevant than the list<'T>
Overall, it's not a terrible syntax, but it feels a lot like someone just invented things along the way as they needed them, without a cohesive plan. Lots of pragmatic but visually ugly choices.
I also take issue with the tooling; things like error messages, or just the antiquated feel of the CLI tools. For example, having a REPL without built-in readline support (rlwrap to the rescue) in this day and age is not acceptable.
Could you show an example, I don't get it?
>The expression termination issue (";;")
Strange, I've never used ";;" in my code, only in repl.
>Operators not being overloaded is annoying, although there's a valid argument for explicitness.
Overloading is harmful. It's definitely the wrong way to do ad-hoc polymorphism, and OCaml have a polymorphic comparison operators, which brought so much headache. Type classes or modular implicits are the right way to do ad-hoc. Looking forward to see modular implicits in OCaml [1].
>For example, having a REPL without built-in readline support (rlwrap to the rescue)
What do you mean by "readline" support?
>The way argumentless functions must be declared with "function".
function is just a sugar for fun+match, what does it have to do with argumentlessness?
let foo : unit -> unit = <code>
let foo = function
| <pattern match stuff>
let foo = (function () -> <code>)
let foo = (fun () -> <code>)
I'm not an expert, but I guess this awkwardness comes from OCaml not having a dedicated function-declaration syntax; so if you do: let foo = do_stuff + 42;
...then you're obviously just defining a variable, which is evaluated right away. Which means that the only way to define a "procedure"-type function that takes zero arguments is the above.> What do you mean by "readline" support?
Readline is a library that adds a line editor to a REPL. It adds keyboard shortcuts (arrow keys etc.), history, autocompletion, and so on. Unlike almost every single REPL out there (Python, Ruby, Haskell, etc.), OCaml doesn't come with built-in support, as far as I've been able to determine. You have to run "rlwrap ocaml" to get Readline into your REPL.
let foo () = <code>There is a great advanced REPL for OCaml if you need something beyond simple stuff:
The one that bugs me the most is nested match expressions, which often need to be wrapped in parenthesis.