4 ms·
OCaml has been one of those "almost there" languages since at least 2002. Most of the worthwhile ideas in OCaml will be absorbed into more popular languages by
by dmpk2k 11mo ago
OCaml has been one of those "almost there" languages since at least 2002. Most of the worthwhile ideas in OCaml will be absorbed into more popular languages by the time existing friction is sorted out. :/
- StopDisinfo910 11mo agoWhat is this alleged friction? Because plenty of people have been shipping great projects in Ocaml since it was released so it doesn’t seem to be much of an issue to many. I doubt Ocaml will be surpassed soon. They just added an effect system to the multicore rewrite so all things being considered, they seem to be pulling even more ahead.
- dmpk2k 11mo agoAlleged? Come now. Beginners face the following problems: there's multiple standard libraries, many documents are barely more than type signatures, and data structures aren't printable by default. Experts also face the problem of a very tiny library ecosystem, and tooling that's often a decade behind more mainstream languages (proper gdb support when?). OCaml added multicore support recently, but now there is the whole Eio/Lwt/Async thing. I used to be a language nerd long ago. Many a fine hour spent on LtU. But ultimately, the ecosystem's size dwarfs the importance of the language itself. I'm sympathetic, since I'm a Common Lisp man, but I don't kid myself either: Common Lisp isn't (e.g.) Rust. I like hacking with a relic of the past, and that's okay too.
- ernst_klim 11mo agoTBH I think it's rather a post-hoc rationalization of why the language is not popular. > there's multiple standard libraries Scala has a far more fragmented ecosystem with Cats, Scalaz, Zio and Akka. C++ and Java have a bunch of stdlib extensions like boost, Guava, Apache Commons etc. > many documents are barely more than type signatures Can be said of most of Java, Kotlin, Scala, Erlang etc etc. Just compiled javadocs, sometimes with a couple of unhelpful lines. > data structures aren't printable by default Neither they are in C++ I think the real reason it's not popular is that there are languages which solve more or less the same problems of system programming but look far more familiar to an avg. programmer who was raised on C++ and Java.
- deleted 11mo ago[deleted]
- dmpk2k 11mo agoMaybe it's post-hoc? I wanted to use OCaml since 2002, since it was a GC'd language with good performance, achieving a lot with relatively few lines of code. Being a language nerd, I was (am?) positively inclined to the language. Yet there was always something that made it notably less pleasant to solve my current problem in than in than some other language. If it had trouble getting traction with me, that's bad news. Meanwhile the mainstream has progressed a lot since 2000. GC is the standard, closures are normal, pattern matching and destructuring are increasingly so. While HM-style type inference is not mainstream, local type inference is (and I'm no longer convinced that global type inference is the way). Algebraic data types aren't unusual anymore. A few years back I just threw in the towel and went with Rust; this happened after I volunteered to improve OCaml's gdb support (including DWARF hell), which went nowhere. I wish Rust compiled faster, and a GC'd language is usually more productive for my problems, but in every other regard it stole what should have been OCaml's thunder. And when popular successor languages eventually appear, they'll do it even better.
- hollerith 11mo agoGC was standard already in 2000: Perl, Python, Ruby, Java and JS all had GC from day 1.
- dmpk2k 11mo agoCrappy GC for most of them, but... fair point.
- creata 11mo agoOff-topic: What language would you say is the closest thing to "Rust with a GC"? (Rust has refcounting, but it's slow, and needing to handle cycles manually limits its usefulness.)
- 11mo ago
- StopDisinfo910 11mo ago> there's multiple standard libraries There is only one standard library and it shipped with the compiler. > data structures aren't printable by default So? That’s the case with most languages. Ocaml has a deriver to make types printable and a REPL which automatically prints for testing. > tooling that's often a decade behind more mainstream languages Opam is a fully featured package manager, dune works fine, bucks2 supports Ocaml. > proper gdb support when? Ocaml has had a rewindable debugger since approximately forever. > OCaml added multicore support recently, but now there is the whole Eio/Lwt/Async thing. Lwt was the default and everyone agrees eio is the future now that effects are there. Async is a Janestreet thing with pretty much no impact on the language outside of Janestreet. Honestly, I maintained my initial point. Ocaml alleged frictions were always widely overstated. When I was writing Ocaml professionally 15 years ago, there was no dune and no opam and it was already fairly easy to use the language.
- brabel 11mo agoYou probably know it, but Common Lisp May be a bit dated but it’s extremely modern in terms of features since you can add almost any feature to the language in libraries! I use it exactly because it’s old and battle tested and I don’t need to wait years for a language designer to give me a feature , I can just add it myself, though these days it has everything done already!
- greener_grass 11mo agoFor me the issue is ecosystem. The foundations are great but I need more useful and well supported packages. For example, there is no OAuth2 client library for OCaml [1] [1] https://ocaml.org/docs/is-ocaml-web-yet https://ocaml.org/docs/is-ocaml-web-yet
- creata 11mo ago> Because plenty of people have been shipping great projects in Ocaml What applications are written in OCaml? All I can think of (which says more about me than it does about OCaml) is the original Rust compiler. Even Haskell has Pandoc and Xmonad.
- jlouis 11mo agoRocq is an excellent example of something OCaml was designed for. FFTW3 is another great example. Unison too. Generally, you want stuff where you have to build a fairly large core from scratch. Most programs out there doesn't really fit that too well nowadays. We tend to glue things more than write from nothing.
- StopDisinfo910 11mo agoRocq, Pfff and Flow, Vpnkit in Docker for Mac and Windows, the web version of Facebook Messenger at a point, Tezos, Unison, the Xen cloud platform, the Mirage unikernel.
- jddj 11mo agoAlmost there, but in the meantime supporting a casual squillion dollars of trades at JS
- zdragnar 11mo agoUnless you're building another JS, it'd be nice if there were other companies so heavily invested in it. There's a lot out there beyond compiler prototypes and high speed financial trades, but there's not enough talk of people using ocaml for those things.
- disgruntledphd2 11mo agoOcaml was (historically, at least) used by Facebook for basically all of their linter/compiler/type checker work. The hack checker was in Ocaml, as was the JS thing (flow, maybe?). So that does seem to be a good use-case for the language.
- zdragnar 11mo agoThat was why I mentioned compilers along with HFT. Rust was originally an ocaml based compiler too. I don't build HFTs and my compilers are just for fun. None of my day jobs have ever been a situation where the smaller ecosystem and community of ocaml was offset by anything ocaml did better than the selected options like .net, Java, go, rails, C or anything else I've touched. Heck, I've written more zig for an employer than ocaml, and that was for a toy DSL engine that we never ended up using.
- ng12 11mo agoYes and they had to basically build their own version of the compiler to keep everything from falling over (https://oxcaml.org/ https://oxcaml.org/).
- byefruit 11mo agoThis is the wrong interpretation of the oxcaml project. If you look at the features and work on it, it's primarily performance or parallelism safety features. The latter going much further than most mainstream languages.
- hardwaregeek 11mo agoPerhaps OCaml is the Velvet Underground of languages. Only a few thousand people learned OCaml but every one made a programming language[1] [1]: https://quoteinvestigator.com/2016/03/01/velvet/ https://quoteinvestigator.com/2016/03/01/velvet/
- greener_grass 11mo agoThat would be Elm :)
- giovannibonetti 11mo agoRoc says hi!
- 1-more 11mo agoI've been saying for ages! Gleam, Roc, Derw, Gren, Cara, Zokka, and the error messages in Rust. https://news.ycombinator.com/item?id=45646520#45752905 https://news.ycombinator.com/item?id=45646520#45752905
- specialgoodness 11mo agoXavier Leroy as Lou Reed... :-) Don't forget the amazing theorem provers too, like Imandra ( https://www.imandra.ai/core https://www.imandra.ai/core ), HOL-Light ( https://hol-light.github.io/ https://hol-light.github.io/ ) and Rocq ( https://rocq-prover.org/ https://rocq-prover.org/ ), ... !
- deleted 11mo ago[deleted]