Ameliorations for exception in OCaml

Hello and happy new year,

Beside the ideal type inference of exception (availaible in several papers, in particular this one: https://www.researchgate.net/publication/269201496_Type-Based_Analysis_of_Uncaught_Exceptions),
I think a few simple things could help the programmer:

  • getting the complete list of exception that a program can raise together with the function of library name that uses them (there is probably a way to get this already, by examining the result of the compilation in dlambda ?)

  • getting a warning when you catch all exceptions and do not re-raise them (which is certainly an error because for instance of Out_of_memory or Stack_overflow). In the rare case you really want to do that (the top loop of your program), you can silent the exception.

See Poor man's static exception analysis with alerts

have you heard about reanalyze?

I dit find reanalyze, but I can not install it with recent ocaml. My code is ocaml 5 only

The numerous library I use (not that numerous, but quite a few) are not decorated.

The 5.3 support isn’t released yet but it will work with OCaml 5.2. If you really want to use 5.3 you can try using reanalyze#203 but i have no idea if it works fully:

opam pin git+https://github.com/rescript-lang/reanalyze#ocaml-5-3 --ignore-constraints-on ocaml

I badly read the constraints generated by opam and thought it needed ocaml < 4.13… I could without problem test with 5.2. Thanks.