Live data from Hacker News

Why I love OCaml (2023)

mccd.space

91–100 of 313 posts

Re: Why I love OCaml (2023)

#91
Why isn't it more popular if it's so good? Because popularity and merit are not the same thing. People confuse them all the time though.

Check out the most popular music today. Like the top ten songs currently. Do you think those are really the best songs out there?

Popularity is mostly driven by either trends or momentum.

Re: Why I love OCaml (2023)

#92
post #13

OCaml’s REPL is lovely, but I found myself having some friction with initial startup. The build/package system was pretty convoluted, and I ended up choosing JS’s Core stdlib for my needs (a simple compiler). With the new multicore release it’d be cool to see OCaml in some more practical projects!

As an OCaml-curious, is this the community recommendation, to choose the Jane Street stdlib if you’re just getting started?

It's probably the path of least resistance if following the Real World OCaml book (https://dev.realworldocaml.org/), which is quite excellent.

Re: Why I love OCaml (2023)

#93
post #51

Elixir is the closest thing to OCaml that has a chance at semi-mainstream usage IMO. It has basically all of the stuff about functional programming that makes it easier to reason about your code & get work done - immutability, pattern matching, actors, etc. But without monads or a complicated type system that would give it a higher barrier to entry. And of course it's built on top of the Erlang BEAM runtime, which ha…

I think it’s odd that elixir doesn’t get more love. It ticks a lot of boxes that folks here get excited about, has a great ecosystem and tooling, BEAM is great, and it’s much more syntactically familiar than erlang to my eye. I know of a couple companies aside from the perennial goto examples that built sizable saas products backed by it.

The backend work I do is just super boring.

I always wanted to learn Elixir but never had a project where it could show it strengths. Good old PHP works perfectly fine.

Also corporations like their devs to be easily replaceable which is easier with more mainstream languages, so it is always hard for "newer" languages to gain traction. That said I am totally rooting for Elixir.

Re: Why I love OCaml (2023)

#95

I kind of wish (like the OP mentioned) there was a ML (ocaml) like language that compiled to Go source. You would get the best of both worlds and access to a huge ecosystem.

There's Borgo: https://github.com/borgo-lang/borgo

I've never used it so can't speak from any experience, and unfortunately it doesn't seem particularly active (and doesn't mention a current status anywhere), and doesn't have a license, so shrug. When it's been posted here (https://news.ycombinator.com/item?id=40211891), people seemed pretty excited about it.

Re: Why I love OCaml (2023)

#96
> why isn’t OCaml more popular

I've used OCaml a bit and found various issues with it:

* Terrible Windows support. With OCaml 5 it's upgraded to "pretty bad".

* The syntax is hard to parse for humans. Often it turns into a word soup, without any helpful punctuation to tell you what things are. It's like reading a book with no paragraphs, capitalisation or punctuation.

* The syntax isn't recoverable. Sometimes you can add a single character and the error message is essentially "syntax error in these 1000 lines".

* Ocamlfmt is pretty bad. It thinks it is writing prose. It will even put complex `match`es on one line if they fit. Really hurts readability.

* The documentation is super terse. Very few examples.

* OPAM. In theory... I feel like it should be great. But in practice I find it to be incomprehensible, full of surprising behaviours, and also surprisingly buggy. I still can't believe the bug where it can't find `curl` if you're in more than 32 Unix groups.

* Optional type annotation for function signatures throws away a significant benefit of static typing - documentation/understanding and nice error messages.

* Tiny ecosystem. Rust gets flak for its small standard library, but OCaml doesn't even have a built in function to copy files.

* Like all FP languages it has a weird obsession with singly linked lists, which are actually a pretty awful data structure.

It's not all bad though, and I'd definitely take it over C and Python. Definitely wouldn't pick it over Rust though, unless I was really worried about compile times.

Re: Why I love OCaml (2023)

#98
post #95

I kind of wish (like the OP mentioned) there was a ML (ocaml) like language that compiled to Go source. You would get the best of both worlds and access to a huge ecosystem.

There's Borgo: https://github.com/borgo-lang/borgo I've never used it so can't speak from any experience, and unfortunately it doesn't seem particularly active (and doesn't mention a current status anywhere), and doesn't have a license, so shrug . When it's been posted here ( https://news.ycombinator.com/item?id=40211891 ), people seemed pretty excited about it.

Borgo looks like some guys phd thesis. It looks like it was a fun experiment.

I feel a new simple ocaml like language that just compiled to Go would be really popular, really fast. And it would not even need to build a ecosystem, as Go already have all the things you need.

Something like what Gleam is for Erlang.

Re: Why I love OCaml (2023)

#99
post #41

OCaml is fantastic, but I avoided it and went with Rust for many projects because it had no multicore story and no green threads for a very long time. But it has that now, and I wish I could go back and start everything over in OCaml.

I've also felt very similar, and adopted Rust for those reasons. Even though I'd still love to have a garbage collected, AOT compiled ML-variant, using OCaml still feels like a step backwards now. OCaml's module system and generics feel clumsy and unintuitive now that I've used Rust's Trait system.

Re: Why I love OCaml (2023)

#100
post #51

Elixir is the closest thing to OCaml that has a chance at semi-mainstream usage IMO. It has basically all of the stuff about functional programming that makes it easier to reason about your code & get work done - immutability, pattern matching, actors, etc. But without monads or a complicated type system that would give it a higher barrier to entry. And of course it's built on top of the Erlang BEAM runtime, which ha…

[deleted]
Post reply on HN