jon.recoil.org

Module Transl_comprehension_utils.Let_binding

First-class let bindings (mutable and immutable); we sometimes need to collect these while translating array comprehension clauses and bind them later.

module Let_kind : sig ... end

Lambda distinguishes between binding forms that bind an immutable (Llet) vs. mutable (Lmutlet) variable; however, we want to be able to abstract over these uniformly, as in some cases we will be collecting lists of variables we want to bind don't want to split the mutable and immutable ones apart. We thus combine the different immutable let_kinds with the option of having a mutable variable and use that to distinguish what sort of let we're generating.

type t = private {
  1. let_kind : Transl_comprehension_utils.Let_binding.Let_kind.t;
  2. layout : Lambda.layout;
  3. id : Ident.t;
  4. debug_uid : Lambda.debug_uid;
  5. init : Lambda.lambda;
  6. var : Lambda.lambda;
}

The first-class (in OCaml) type of let bindings.

Create a fresh local identifier (with name as given by the string argument) to bind to an initial value given by the lambda argument.

Create a Lambda let-binding (with Llet) from a first-class let binding, providing the body.

Create Lambda let-bindings (with Llet) from multiple first-class let bindings, providing the body.