OCaml seems to be a lovely language based on my limited experience with it. It’s a pity it’s not more popular.
Elixir vs ocaml I use both languages but for such completely different things I don't even think about a comparison. Elixir is for when the problem I have suits beam's strengths.
It just shows the mindset of its devs was a little behind the realities of the industry, or they simply didn't care about concurrency.
In comparison, I like how Python always tries to be on top of things by exploring new PEPs.
OCaml cared about concurrency (e.g. Lwt, Async are old libraries that provide concurrency -- they didn't need multicore Ocaml). OCaml didn't care so much about true _parallelism_ in threads until recently. Parallelism was to be obtained via processes and not threads in pre OCaml 5.0. True parallelism in threads is available in OCaml >= 5.0
Python is actually trying to go multicore too ! OCaml however beat it to the punch. The strengths of Python are elsewhere though, a topic for another day.
This is debating the relative finishing places of the two runners finishing last in the marathon after most of the other runners have already gone home and had their dinner.
I suspect a larger or at least comparable limitation was essentially pretending windows didn't exist for uh like thirty years. If you knew what you were doing you could cross compile for it but it was not easy. Getting a dev environment running on windows was basically impossible until like five years ago.
The syntax idk I don't have strong feelings about it. I initially recoiled like everyone else of course, but to me style and naming conventions are almost as important and on that front ocaml's are also among the worst in the world lol. Once you get used to it it's kind of endearing how fucked up it is.
I’m a bit lost because Ocaml has a Pascal-like syntax (I find it nice but I generally dislike B syntax and am amongst the rare bread of developer who didn’t start with a language using it) and an extremely nice naming convention. Ocaml strongly discourages overloading, weird operators and shortly named variables unless they are local and used for a short time or an idiom like the default type of a module being named t. Everything has a long name in a module with a long name. It’s extremely nice.
OCaml's syntax is not particularly Pascal-like. It'd be very hard for someone to mistake Pascal code for OCaml or vice versa.
It obviously went through ML but you can tell the influence.
Ocaml issue never was the syntax which is completely fine. The current syntax is actually a lot nicer that what Facebook proposed. Ocaml issue is not being a USA-born project nor having a significant marketing push in English.
Plus, Ocaml always was too far ahead of its time (including now with its effect system). First, you have the functional approach which was already very unfamiliar for most. Then, you have to add module level programming on top which is still very unfamiliar to most. Just look at this comment page and people thinking Ocaml is not fun to use or less interesting than Haskell, it's trully sad.
Multicore has added the extremely promising effect system but that's once again a step too far for most current developers.
In a lof of way, Ocaml is to programming language what the Pixies are to rock music. Everyone who felt deeply in love with it went on to write a language of their own. Some got really successful.
Python is a counter argument here.
The first version was announced in English on Usenet. Van Rossum moved to the USA quite quickly to work on Python from CNRI in 1995. Then, it got funding from DARPA in 1999 with this as part of its pitch: "Create a code that is easy to understand and looks as easy as the English language."
Ocaml meanwhile is an INRIA child made by a French team to develop another INRIA child made by another French team. I think in Europe, that's approximately as US hostile as you can be.
Actually, Ocaml has only become somewhat popular since it's pushed a bit from the UK which I find amusing.
I would love to replace my Go code with OCaml. It was always kind of on the verge though. On one hand, once you use a proper type system, you cannot look at Go. On the other, Go's multicore is just so much better than Async/Lwt. In terms of programming, in terms of debuggability, surely in terms of performance too. Having proper multithreading in 5.0 suddenly makes OCaml strictly superior in my (rather biased) opinion.
There's nothing comparable to ocaml's module system that I know of in any other mature language so no one really arrives in ocaml with well developed intuition for what sorts of things are possible and worth doing with it. But once you've put the time in it's usually the correct answer to "how to do I do <haskell type system thing> in ocaml."
I'm not a type systems expert though and it's likely there are some novel & unique situations where it's the best or only solution. Just maybe not as much as people assume from outside. Anyway I think there is a proposal for it so it'll probably work its way in eventually.
On the same note, the lack of some kind of module system along these lines (broadly all defined in terms of "holes" in a compilation unit which are "plugged up" later on at instantiation time), is one of my biggest complaints about Rust. The extensive usage of traits in the broader ecosystem results in this phenomenon (identical to Haskell) where global coherence requires your dependency tree gets tied up in the location of types and their trait impls. In other words, you cannot abstract over your dependencies in a truly modular way.
Global coherence requirements are fine (preferable even!) for many things but if it's the only hammer you have, well, you know the rest of the metaphor.
> Anyway I think there is a proposal for it so it'll probably work its way in eventually.
Modular implicits have been shelved indefinitely from what I understand, if that's what you're referring to.
I love Ocaml (and Haskell-esque) syntax, but I must admit it can be detrimental to getting adopted.
I think another issue was bad tooling for a long time. Now with Dune it's great though, with very fast compile speeds.
Hopefully OCaml slowly gets the recognition it deserves, because it really is a great language.
Tons of languages started outside the US. Python and Ruby being notable.
I'm a bit surprised to see no mention of Owl (https://github.com/owlbarn/owl an older project for scientific computing in OCaml that was resurrected recently), I wonder how they compare.
The Raven README mentions:
> We prioritize developer experience and seamless integration.
so maybe that's one difference — I used Owl on a course project about a decade ago, and while it got the job done, I remember the experience being rather painful compared to Numpy (even though I was more experienced with OCaml than with Python at the time).
- https://github.com/dotnet/TorchSharp
- https://github.com/DiffSharp/DiffSharp
I have a hand-rolled proxying inference framework written in Python that is similar in purpose to something like LangChain but much more stripped down, less abstraction. Similarly to many other Python tools, it leverages the reflective capabilities of the language to do things like ask LLMs for responses conforming to a data class, or pass native Python functions as tools. Best of all, it relies on native Python constructs like docstrings to provide additional context to the inference APIs, making clean and well documented code a secondary programming model in a sense.
Perhaps it’s vanity, but at least in Python I find the resulting code quite elegant. I became curious what it would be like to port this to other languages, and surprisingly found that F# would, to my eyes, end up with the most lovely analogue.
Even languages I expected to be expressive and terse, like Haskell, couldn’t express the same ideas as understandably yet concisely as F#.
In particular, it shines on very large models or where fast quasi real-time inference is required.
I don't want to write code in a browser. For python you have something like ipython which allows you to have an interactive experience, while also allowing you to have your favourite editing environment. For ocaml, surely there are also repls that provide this kind of thing.
And it also was a good way to get comfortable with using terminal.
Using notebooks removes all these learnings. I dislike it because it makes for less confident programmers in the long run.
It drives me nuts that some people see this as «either or».
Linqpad is another and different take on data-driven environments. As is various «SQL admin» alternatives.
If I don’t, the notebook quickly becomes bloated, I start getting paranoid about stale cells and lose track of what I'm actually trying to do.
Ideally the notebook’s sole purpose is interactivity, as kind of a quick-and-dirty frontend when it's not worth it to write an actual frontend, everything infrastructural gets moved out.
evacchi•8h ago