OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of December 21 to 28, 2021.

Happy Winter Solstice!

Table of Contents

New release of Feat

François Pottier announced

I am happy to announce a new release of Feat, a library that offers support for counting, enumerating, and sampling objects of a certain kind, such as (say) the inhabitants of an algebraic data type.

This new release integrates a contribution by Jonah Beckford. The library is now split in three packages: feat-core is parameterized over an implementation of big integers; feat instantiates feat-core with big integers provided by zarith; feat-num instantiates it with big integers provided by num.

opam update
opam install feat
# or: opam install feat-num

More details can be found here:

https://gitlab.inria.fr/fpottier/feat/

Debugger support for OCaml

Christian Lindig asked

What is the current state of debugger support for OCaml? I am aware of ocamldebug but every time I'm trying to use it I feel thrown back to 2000 where it essentially existed in the same form (and still has no command line editing built in). Despite the powerful concept of time traveling, it does not seem very useful today. For example, it can't be attached to a running program and it does not work with native code. What is the state of GDB support? What debugger would one use on macOS?

linoscope replied

Have you taken a look at ocamlearlybird (github, announcement)? I have never used it myself, but based on the demo it seems pretty nice.

Sid Kshatriya also replied

I agree that debugging in OCaml seems to be stuck in time.

This is extremely unfortunate because it is able to do time traveling (as you mention) which is something that many other languages still cannot boast.

  • ocamldebug does not work properly when there is more than 1 OS thread
  • As types are erased during compile time in OCaml, it can be difficult to debug polymorphic functions. Rust and C/C++ monomorphise all code so there is never any confusion about the type of anything in the debugger. Golang and Java have type information available during runtime so again, debugging is easy. In this respect OCaml is similar to Haskell while using the byte-code debugger.
  • The future of ocamldebug is unknown on multicore

As far as GDB support is concerned, there was a project to improve GDB support (so you could print out variables like in ocamldebug IIUC) but it never got merged into trunk.

However, if you are interested in low level debugging in gdb, here is a recent answer related to this.

My guess is that ocamldebug will continue to work for the single domain, single thread case in OCaml 5.00 but ocamldebug is currently broken in multicore there (AFAIK).

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 online.