5 ms·
What is OCaml mostly used for? Like Ada for aerospace or Erlang for concurrency, does OCaml has a niche like that?
by _benj 4y ago
What is OCaml mostly used for? Like Ada for aerospace or Erlang for concurrency, does OCaml has a niche like that?
- melissalobos 4y agoPeople will mention Jane Street for financial stuff, but mostly academia and compilers.
- curiousgal 4y agoThere's also LexiFi for finance.
- fancyfredbot 4y agoDoes LexiFi use vanilla OCaml now? I remember that in the past they had created their own custom dialect.
- anuragsoni 4y agoI've used OCaml at day-jobs for the past couple of years. It has an excellent concurrency story, and I've used OCaml for lots of "boring" work (web services, database drivers, data processing, etc).
- giraffe_lady 4y agoI really think it's such a good fit for most of the daily non-web work I've had to do. It lets you keep the core logic clean & fun and then you can just shrug and let rip with the mutations or whatever when that makes the most sense. I'm well out of my FP fanboy phase now but ocaml feels great for my favorite parts of that without being judgmental when I'm not in the mood.
- anuragsoni 4y ago> It lets you keep the core logic clean & fun and then you can just shrug and let rip with the mutations or whatever when that makes the most sense. Very true! I've used mutations and imperative OCaml quite a few times. Sometimes it was for performance reasons (I've been working on a web server library), and other times when loops either made the implementation a little easier to read, and/or helped avoid some allocations. I am glad that the language is pragmatic enough that I can still use mutation or imperative code where it makes sense, while still being able to present a nice clean api on top.
- giraffe_lady 4y agoWait how did you go about finding ocaml day jobs? I pretty much never even tried it seems so niche, and jane street doesn't appeal to me at all. I sneak it in at my jobs when I can justify it but it seems like there are very very few jobs that use it primarily.
- whimsicalism 4y agoI think FB uses OCaml at least to some extent.
- giraffe_lady 4y agoYeah I think that's a good example of what I mean though. That'll be a couple tiny teams within a huge org, with a lot of people willing/desiring to transfer internally onto it. Those rarely if ever get filled from outside the org, and when they do they're looking for experts not competent part-time users.
- anuragsoni 4y agoThe first time was hearing about a startup that used OCaml on one of the monthly hackernews Who is hiring thread. The current day job was also somewhat similar in that I had read about a startup's job listing on the OCaml forum [1], checked with them again a while later (the startup was acquired by another company), and found an open role on the team that continued to use OCaml after the acquisition. > it but it seems like there are very very few jobs that use it primarily. I completely agree. I never tried looking for an OCaml job mostly because there weren't enough options at-least in the US (I'm based in USA), and I am picky about who I work for and wasn't interested in exploring job opportunities at companies working on cryptocurrencies. I just got lucky that I stumbled upon two different companies that used OCaml. The first time around I applied for the job because of OCaml, the second time around it was because I liked the company and OCaml was an added bonus on top. [1] https://discuss.ocaml.org/ https://discuss.ocaml.org/
- giraffe_lady 4y agoUgh yeah that pretty much confirms what I suspected. It's a few huge players using it for small internal projects, jane street, and a bunch of crypto shit I'm not willing to touch. The language I work in is not even one of my top priorities when looking for work, but still it would be cool. I'm lucky enough to have enough freedom to work in it from time to time, which is good enough for me. Thanks for the response!
- bhawks 4y agoTezos's reference node Octez is written in OCaml and one of the main smart contract languages Ligo really shows it's OCaml roots. https://tezos.gitlab.io/ https://tezos.gitlab.io/ https://ligolang.org/ https://ligolang.org/ It's a nice change of pace from the Ethereum ecosystem.
- jamal-kumar 4y agoYeah especially considering the safety guarantees that ocaml offers over say solidity. If tezos ever went above 10$ maybe I'd be able to convince people who are going all in on ethereum to start projects with it.
- xvilka 4y agoProgram analysis and formal verification.
- UncleOxidant 4y agoIn addition to what others have mentioned, it's a great language for writing compilers and interpreters.
- hyperhopper 4y agoThis is totally a biased cop out, but I'd say "most things". Like, what's java's niche? I'd say it doesn't really have one anymore, it's just a generalist language. Ocaml is also a generalist language, but it has much better language paradigms, is safer, more concise, has more features with less baggage, etc. It's just good all around. As a functional programming advocate, I'd point to safety, readability, and development velocity as features, but those are all around good and desirable, not really a niche. I wish more companies were using languages like ocaml/f#/clojure vs c++/python/java when there is no specific reason to use the former.
- afandian 4y agoWhich side would you put Kotlin in? Feels equidistant between Clojure and Java.
- progre 4y agoMaybe it's more usefull to talk about a 'slant'? Like, you can totaly do desktop apps with custom GUI components in Java but those tends to be written in C++ for some reason. Like java, python, c# 'slants' towards web services and maaybe CRUD apps, C++ 'slants' towards games and graphicly complex apps.
- nicoburns 4y agoI have no personal experience, but I've heard OCaml is particularly excellent for writing compilers.
- junon 4y agoI've seen it in things where performance isn't super important (OCaml is slow as per my experience). Many, many provers/theorum solvers use OCaml because it reduces the bugs in the provers themselves.
- agravier 4y agoOCaml is not slow in my experience, but we should probably look at what big teams using OCaml in a performance sensitive setting have to say. https://www.janestreet.com/tech-talks/safe-at-any-speed/ https://www.janestreet.com/tech-talks/safe-at-any-speed/
- chazeon 4y agoI know Jane Street use the hell out of OCaml, the whole company is almost built on top of it.
- sweetsocks21 4y agoIt's surprisingly general purpose. I mostly use it for toy side projects. I've used it for basic CRUD apps, like a reddit aggregator. I've written a couple opengl graphics libraries with it. Used it instead of JS for a web implementation of a board game. a toy Datomic clone, and I'm currently working on an alternative unix shell. It's pretty comfortable for organizing and refactoring because of the nice module and type system. And once you grok Dune (the build system) you can get going pretty quick. Builds are very fast compared to most of the languages I use at work. And if you're not doing anything egregious the optimizing compiler (Flambda) can usually be within ~2x of C for most things. When it's not dropping down to C is very easy because the FFI system is very straight forward, and has built in support in Dune. It is lacking a bit in libraries and when you need to drop down to imperative features you may find it a bit rough. For example not having a return keyword can make it annoying to port over libraries. Overall I like it because I think the pros outweigh the cons, but I've also been using it for a decade so I'm probably getting set in my ways now. I'd say it's worth trying at least to understand Sum types (and maybe GADTs), and use a language with first class modules, it can change your approach to problems once you see some extra tools.
- WastingMyTime89 4y agoIt was written in tandem with a prover and is generally very nice to use to develop compilers and analysers. The biggest company using it does algorithmic trading with it.