Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on lemmy.eco.br

12 replies

I programmed pretty intensively in OCaml a couple years ago to get a better understanding of the language.

It is a fine language, perfectly suited for general purpose programming, and is in general decently ergonomic. I personally won't use it as my perfered language though. I find the functor/module system way too powerful, and can easily cause confusion in complex settings. There really is no better system for adhoc polymorphism than type classes. But people standby modules though.

I feel the good part of OCaml are generally avaliable in most good programming language, thus I kind of feel that the share for OCaml might slowly getting eaten by Rust, but we will see.

2
lemmy.world

Everyone should pick up an obscure language and try to be productive with it. It teaches you to be self-sufficient.

4

you can just do the same thing in a more useful way by learning a more mainstream language with great documentation, but limiting yourself to only using the documentation.

1

I think that it's fine technically --- the ML family of languages have extensive static typing functionality that I like --- but Rust has enough overlap in functionality and has greater uptake. (I say this not having spent enough time to really come up to speed on Rust myself.) A quarter century back, ocaml was the language that I was most impressed with for strong static typing functionality. In 2026, I think I'd probably look at Rust and only go to ocaml if Rust doesn't suit your needs.

As to whether it can be a "daily driver"...I mean, you can use any language daily. I do think that it's hard to appreciate how helpful it is to have all the examples and library support and tools until you move from a popular language to a less-used one and suddenly discover that you want something that isn't there.

So can you use it? Sure. Is it the first option I'd recommend to someone who --- and I assume that this is why you're looking at it, if your alternative is Python --- wants to move to a statically-typed language? No. Is it a terrible choice? No, it'd also be a long way from the bottom of the list that I'd recommend.

3

It's a pretty mature language so I see no reason why it can't be used for general purpose. Though I would check if they have proper libraries that fulfills whatever task you're trying to complete first. For instance, if you're doing machine learning, I would probably stick to Python.

One thing to note is that it's a functional programming language. If your previous exposure to programing in general is limited to Python, you will find the syntax and the general way of doing things confusing.

5

Unrelated to the thread. Thats a great username. [Object Object] haha.

3

OCaml is a complete language you could use it as a daily driver. Cornell put out a pretty cool course here. It's very closely related to F# which which is neat!

3

Some time ago I wanted to start learning a functional language and looked at Ocaml and Elixir. Ocaml looked like a quite versatile language but in the end I went with Elixir because it looked like it could open up more new use cases compared to the languages I already knew (Python, C). Massive concurrency looked cool and also I wanted to get a bit into web dev stuff and Elixir has the Phoenix framework for that. So depends on what you want to do with it I'd say and how experienced you already are.

1

If you want to learn it for fun, practice and personal projects - yes.

Do you already know another programming language? If so learning additional languages is a benefit, the more you know the easier will be to pick up new ones. If you're just starting, Python is a better choice to get over the basics.

2

It was fun in college and a bit after. You dont lose anything learning it.

I personally like python more for scripting an MVP out really quick. Ocaml has some nice algorithmic stuff and I remember a UI library that made it fun.

1

I would not recommend OCaml for a beginner, and while is probably a tad faster than Python, its userbase sizes differ wildly as in: Python is basically everywhere, while Caml/OCaml is an absolute small niche.

1

You reached the end