Why not place exn in function signature?

Hmm … not sure myself but I would guess it is the type system.

I think such exception catch notification like java would help in large project.

Indeed, I think most large ocaml projects follow the result/option way. For more about exception/error see Exceptions vs Option. Additionally, see
https://mirage.io/wiki/mirage-3.0-errors - which details how errors are handled in mirage - a large industrial ocaml code base.

I would say that ocaml way of handling error is far superior to java, both from performance and semantics point of view but ymmv.

1 Like