Stdlib vs Base in 2025 (beginner)

Hello. I’ve restarted my OCaml learning journey and am working on some exercises. One source I’m using is Exercism, which defaults to using Base for exercises. I’m reading OCaml From the Very Beginning and OCaml Programming: Correct + Efficient + Beautiful, which don’t mention Base, and as far as I can tell, rely on Stdlib.

Have Stdlib and Base come closer together in recent years? If so, does it make sense to start off using Base in 2025? My initial experience using Base is not stellar because 1.) I just want to get started and not have to deal with two options, and 2.) it is unexpected to have to go to a different source (not ocaml.org) for the documentation.

Back to my exercises now. :wink:

2 Likes

2.) it is unexpected to have to go to a different source (not ocaml.org) for the documentation.

The documentation for Base is generally available on ocaml.org: base v0.17.1 · OCaml Package

It does seem like there is a regression for v0.17.2 and the docs are missing. You may want to report that issue on the base repo.

Have Stdlib and Base come closer together in recent years?

Come closer in terms of design philosophy / API design / naming conventions?
AFAIK, no one is trying to make them come closer together, and they haven’t.

If so, does it make sense to start off using Base in 2025?

Personally I think it does, but others disagree.

2 Likes

Thanks @smolkaj. Interesting thread you shared.

I had already created Latest (v0.17.2) has no docs on https://ocaml.org/p/base/latest · Issue #181 · janestreet/base · GitHub

1 Like

My personal preference (partially informed by which projects I tend to work on, partially just an aesthetic preference, and partially not based on anything ) is to use the Stdlib (which has steadily and quietly grown over the last few years) and pull in bits of Containers as needed if I get tired of implementing too many common helpers.

That said, for the purposes of learning I don’t think there is anything lost in either path, as i find it’s no trouble to work in projects oriented around Base when needed, and I think going the other way would be just as easy.

4 Likes

To bring the experience slightly closer, open StdLabels when using Stdlib since Base is extensively labelled. But personally I don’t do that…

I use both Stdlib and Base, the former for libraries I would like to be more broadly depended on.

2 Likes