When programming in OCaml, some functions are available by default in the global scope. For example, the open_in function to open a file.

This function is not actually global, it is defined in a module called Pervasives that is open by default. In some cases, it can make sense to refer to it by its full name, Pervasives.open_in. This can be useful if another function named open_in is already in scope. Some people also prefer to be explicit when referring to these functions.

However, doing so in recent version of OCaml will trigger a deprecation warning:

Error (alert deprecated): module Stdlib.Pervasives
Use Stdlib instead.

This is because the global namespace has been reorganized: now there is only one global module called Stdlib that is open by default. This means that one needs to refer to Stdlib.open_in instead.

But wait, how to support multiple versions of the compiler then? Pervasives triggers a deprecation warning in new versions, but Stdlib does not exist in old ones.

That is exactly what the stdlib-shims library fixes: it provides a definition of Stdlib for old compilers, and does nothing for new compilers. To use it, one just has to add it to the list of dependencies in (libraries) in the corresponding dune file.

This can be done in a couple of lines, for example here is how it was done for the git library.