4 ms·
"beautiful" But then it has quirks like using ;; to end statements (EDIT: only in the REPL). And comments with that weird syntax But worse of all are the opti
by raverbashing 4y ago
"beautiful"
But then it has quirks like using ;; to end statements (EDIT: only in the REPL). And comments with that weird syntax
But worse of all are the optional parenthesis in function calls. Yes, I know Ruby has it. But it feel super weird and a needless flexibility (that causes more confusion than it solves).
I can't get over this stuff, sorry.
- jon_smark 4y agoI have to interject here for the sake of those unfamiliar with OCaml and who may take the parent comment at face value. Saying "it has quirks like using ;; to end statements" is misleading to the point of just being bogus. The double semi-colon is only ever used in the REPL. In fact, I've been programming OCaml for fun and professionally for over 15 years, and I've never used a double semi-colon in my code, nor have I ever encountered one in the "wild".
- raverbashing 4y agoThanks for clarifying
- toolslive 4y ago> worst of all are the optional parenthesis in function calls ?? > let r = some_function x y z in ... There are no parentheses here, and it's not optional. What you probably are missing is that if `some_function` takes 3 arguments, then `some_function x y` is a function value that takes 1 parameter (currying). Btw, iirc, SML doesn't have this: there you only have 1 parameter but it could be a tuple
- raverbashing 4y ago> Note how OCaml is flexible about whether you write the parentheses or not, and whether you write whitespace or not. from here https://cs3110.github.io/textbook/chapters/basics/toplevel.html#functions https://cs3110.github.io/textbook/chapters/basics/toplevel.h...
- toolslive 4y agoisn't that the case in most programming languages ? In essence, if you have an expression exp then (exp) is also an expression. So nothing special about OCaml in that regard. [note, just checked python, php, and js and it is the case]
- raverbashing 4y agoOk so maybe the example is confusing, because it seemed it was talking about function calls (where they are mandatory in the languages you mentioned)
- frou_dh 4y ago> Btw, iirc, SML doesn't have this: there you only have 1 parameter but it could be a tuple Nah, SML does also support automatically curried function definitions, it's just that by convention that feature didn't get used as often. I tried to find out why that was the case a while ago, and stumbled on this explanation: https://www.reddit.com/r/ProgrammingLanguages/comments/jde9xp/advantages_of_currying_in_a_programming_language/g97szvz/ https://www.reddit.com/r/ProgrammingLanguages/comments/jde9x...