OCaml Weekly News
Hello
Here is the latest OCaml Weekly News, for the week of February 04 to 11, 2025.
Table of Contents
ocamlmig, a tool to rewrite ocaml code, and complement [@@deprecated]
v-gb announced
Hi,
I'm glad to announce ocamlmig, a command line tool for rewriting ocaml source code with access to scope and type information.
As the simplest example of what it's intended for, let's say an opam-installed library A provides this interface:
val new_name : int -> int val old_name : int -> int [@@migrate { repl = Rel.new_name }]
and your repository contains a file b.ml:
let _ = A.old_name 1
then you could run:
$ git diff b.ml $ ocamlmig migrate -w $ git diff b.ml -let _ = A.old_name 1 +let _ = A.new_name 1
Obviously, it's not limited to renames.
When I meant by "complement [@@deprecated]
" is that instead of providing a textual description [@@deprecated "please use this thing instead" ]
, you get to provide an executable description. The goal is to reduce the friction when the interface of a library evolves. If people get in the habit of running this regularly (after every opam upgrade~/~dune pkg lock
, say), then it could also be a way to get users to switch to new interfaces without having to deprecate the old interfaces immediately.
Additionally, using that and a couple of other builtin transformations like removing ~open~s, you can execute some refactorings, without learning anything like ppxlib or the ocaml ast, for instance:
- Renaming operators (not easy with sed or the like, because the operators change precedence)
- Switching code using both Stdlib and Core to mostly Core
If that piqued your interest, here is more information about what ocamlmig does, and using it.
This is decidedly work in progress, many things are not fully implemented, and it needs a lot of polish, but the existing functionality as is should still be interesting.
Mopsa 1.1 – Modular Open Platform for Static Analysis
Archive: https://discuss.ocaml.org/t/ann-mopsa-1-1-modular-open-platform-for-static-analysis/16095/1
Raphaël Monat announced
Dear all,
On behalf of all its developers, I am glad to announce the release of Mopsa v1.1! You can just opam install mopsa
.
What is Mopsa? Mopsa stands for Modular and Open Platform for Static Analysis. It aims at easing the development and use of static analyzers. More specifically, Mopsa is a generic framework for building sound static analyzer based on the theory of abstract interpretation. Mopsa is independent of language and abstraction choices. Developers are free to add arbitrary abstractions (numeric, pointer, memory, etc.) and syntax iterators for new languages. Mopsa encourages the development of independent abstractions which can cooperate or be combined to improve precision.
v1.1 changes. This new version brings several expressivity, precision and interface improvements, notably:
- Trace and state partitioning. ⚠️ introduces breaking changes in the API of domains.
- Suggestions to trigger automatic testcase reduction whenever Mopsa crashes
- * As a side-effect, Mopsa is able to generate preprocessed files from make targets using option
-c-preprocess-and-exit=file.i
, which might be useful for other users too! This has been experimented on our coreutils benchmarks, and can also be used to generate the preprocessed files used in the Software-Verification Benchmarks. - Bash completion support, thanks to arg-complete developped by Simmo Saan.
Other OCaml News
From the ocaml.org blog
Here are links from many OCaml blogs aggregated at the ocaml.org blog.
Old CWN
If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.
If you also wish to receive it every week by mail, you may subscribe to the caml-list.