Module Caml_exceptions

type t = {
  1. id: string,
};

Could be exported for better inlining It's common that we have

a = caml_set_oo_id([248,"string",0]) 

This can be inlined as

a = caml_set_oo_id([248,"string", caml_oo_last_id++]) 
let id: Bs_stdlib_mini.ref(int);
let create: string => string;
let caml_is_extension: 'a => bool;

This function should never throw It could be either customized exception or built in exception Note due to that in OCaml extensible variants have the same runtime representation as exception, so we can not really tell the difference.

However, if we make a false alarm, classified extensible variant as exception, it will be OKAY for nested pattern match

match toExn x : exn option with
| Some _
  -> Js.log "Could be an OCaml exception or an open variant"
(* If it is an Open variant, it will never pattern match,
   This is Okay, since exception could never have exhaustive pattern match

*)
| None -> Js.log "Not an OCaml exception for sure"

However, there is still something wrong, since if user write such code

match toExn x with
| Some _ -> (* assert it is indeed an exception *)
  (* This assertion is wrong, since it could be an open variant *)
| None -> (* assert it is not an exception *)

This is not a problem in `try .. with` since the logic above is not expressible, see more design in destruct_exn.md

let caml_exn_slot_name: t => string;

FIXME: remove the trailing `/`

let caml_exn_slot_id: t => int;