OCaml Syntax Sucks (2016)
81–90 of 140 posts
Re: OCaml Syntax Sucks (2016)
#82F# syntax improves on this I think. But why is the article so short? It ends abruptly
Re: OCaml Syntax Sucks (2016)
#83Re: OCaml Syntax Sucks (2016)
#84I want to like OCaml, but the tooling isn't great and async operations require a library to work for some reason. I tried f# but if you want to do async operations there, you have to do them in these even weirder "computation blocks" with this annoying ! Syntax. I've found that the best way to write ML family programs is to let an imperative language handle IO and then write any more mathematically or logically compl…
You might like Scala. It has much of the good parts of OCaml or F#, but also lets you write imperative code freely when you want. The `for`/`yield` syntax for async is very nice IMO, or you can write Javascript-like promise chaining directly if you want.
Gleams a nice one too if you want pure functional, small community though.
Re: OCaml Syntax Sucks (2016)
#85Earlier quoted context omitted.
2. In general there aren’t a ton of punctuation characters that are very common, which is great for typing ergonomics. Don’t get me wrong, there are still a lot of symbols, but I feel compared to some languages such as Rust, they’re used a lot less. I never really seen someone put that into words. I always feel a certain kind of weird when I look at a language with tons of punctuation (Typescript is good example).
I think typing ergonomics are overlooked as well. CSS has the most verbose syntax for variables I've had to use regularly e.g. `var(--primary-color)` which I find unpleasant to type when experimenting. And I actually like the lack of brackets and commas in OCaml for function e.g. you write `add_numbers 1 2` instead of `add_numbers(1, 2)`. Brackets and commas in particular require you to navigate left/right a lot to a…
The accent grave (backtick) you're using in a Markdown-inspired way is utterly annoying to type on keyboards where accents are implemented as dead keys, to be combined with vowels, common on european keyboard layouts. For your example I had to type `, but then look ahead to the a of add_numbers and remember to put in an extra space, so that the ` and the "a" don't combine to an "à".
Also I find it somewhat illogical: The usage of an accent as a character in itself in programming languages is one of my pet peeves. Just being an ASCII character is not reason good enough to keep using it.
Curly or square brackets, backslashes and other stuff also put you into uncomfortable AltGr or Cmd-Shift territory on some keyboards. American language designers are often blind for these simple ergonomics.
Re: OCaml Syntax Sucks (2016)
#86Re: OCaml Syntax Sucks (2016)
#87I 100% agree. The lack of clear scoping and function call grouping syntax just turns it into a word soup. It becomes difficult to parse for humans and I spend a stupid amount of time just getting the semicolons, begin/ends, etc. right. It's like... when you mismatch brackets or braces in a C-style language, except to resolve the problem you can't just find the bracket that's highlighted in red and count; you have to…
Re: OCaml Syntax Sucks (2016)
#88I tried out OCaml last year for solving the AOC puzzles. I managed to solve all of them in earlier years using Haskell or Scala, but this was the first time I gave up. It was not as much the syntax, it was the schism between the OCaml standard libraries and those from Jane Street that turned me off. Whatever I was searching for on the Internet, resulted in a mix of links to either of those libraries. It was confusing…
After reading OCaml From The Very Beginning my stance softened. Learning PURE OCaml is a must. (if you want to do AoC with it). You may find yourself bringing in Core or Base, after you've got a good idea of a solution.
It's definitely a fun language for doing AoC... but it can become extraordinarily frustrating when you hit a wall and all the StackOverflow answers assume Core.
Re: OCaml Syntax Sucks (2016)
#89Earlier quoted context omitted.
Depends on what you compare it with, I guess. (I worked in OCaml and Haskell and other 'weird' languages professionally in different jobs for many years.)
Fsharp is pretty good in teams f tooling at least when compared to other functional languages
I've considered trying it for Advent of Code this year.
Re: OCaml Syntax Sucks (2016)
#90There’s indeed something wrong with a syntax that needs double semicolons all over the place.