Re:Jane Street Tech Blog – Oxidizing OCaml: Locality
by ianthehenry on Saturday May 27, 2023 @06:57PM
(#36099245)
From the post:
> Even without explicit mode annotations, the compiler can statically determine which variables may escape their enclosing region. Such variables are assigned the global mode; all others are automatically inferred to be local.
There's a little more info about mode inference in the proposal:
So arguments to "public functions" do require explicit annotations in order to be local, but otherwise the compiler is able to infer locality and this acts as a transparent optimization.
> Even without explicit mode annotations, the compiler can statically determine which variables may escape their enclosing region. Such variables are assigned the global mode; all others are automatically inferred to be local.
There's a little more info about mode inference in the proposal:
https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/do...
So arguments to "public functions" do require explicit annotations in order to be local, but otherwise the compiler is able to infer locality and this acts as a transparent optimization.