Quick StartTryGuideAPICommunityBlogGitHub

Standard Library

Below is the API for the OCaml standard library. It's directly copied over from the OCaml Manual, formatted to the Reason syntax and styled accordingly. The API docs are work-in-progress; we'll be polishing these gradually!

If you're targeting JavaScript, the API docs for BuckleScript includes all of below, plus JS-specific APIs.

Module CamlinternalOO

module CamlinternalOO: sig .. end
Run-time support for objects and classes. All functions in this module are for system use only, not for the casual user.


Classes

type tag;
type label;
type table;
type meth;
type t;
type obj;
type closure;
let public_method_label: string => tag;
let new_method: table => label;
let new_variable: (table, string) => int;
let new_methods_variables: (table, array(string), array(string)) => array(label);
let get_variable: (table, string) => int;
let get_variables: (table, array(string)) => array(int);
let get_method_label: (table, string) => label;
let get_method_labels: (table, array(string)) => array(label);
let get_method: (table, label) => meth;
let set_method: (table, label, meth) => unit;
let set_methods: (table, array(label)) => unit;
let narrow: (table, array(string), array(string), array(string)) => unit;
let widen: table => unit;
let add_initializer: (table, obj => unit) => unit;
let dummy_table: table;
let create_table: array(string) => table;
let init_class: table => unit;
let inherits:
  (table, array(string), array(string), array(string), (t, (table, obj) => Obj.t, t, obj), bool) =>
  array(Obj.t);
let make_class:
  (array(string), (table, Obj.t) => t) => (t, (table, Obj.t) => t, Obj.t => t, Obj.t);
type init_table;
let make_class_store: (array(string), table => t, init_table) => unit;
let dummy_class: ((string, int, int)) => (t, (table, Obj.t) => t, Obj.t => t, Obj.t);

Objects

let copy: ({..} as 'a) => 'a;
let create_object: table => obj;
let create_object_opt: (obj, table) => obj;
let run_initializers: (obj, table) => unit;
let run_initializers_opt: (obj, obj, table) => obj;
let create_object_and_run_initializers: (obj, table) => obj;
let send: (obj, tag) => t;
let sendcache: (obj, tag, t, int) => t;
let sendself: (obj, label) => t;
let get_public_method: (obj, tag) => closure;

Table cache

type tables;
let lookup_tables: (tables, array(closure)) => tables;

Builtins to reduce code size

type impl = 
| GetConst
| GetVar
| GetEnv
| GetMeth
| SetVar
| AppConst
| AppVar
| AppEnv
| AppMeth
| AppConstConst
| AppConstVar
| AppConstEnv
| AppConstMeth
| AppVarConst
| AppEnvConst
| AppMethConst
| MethAppConst
| MethAppVar
| MethAppEnv
| MethAppMeth
| SendConst
| SendVar
| SendEnv
| SendMeth
| Closure of closure

Parameters

type params = {
   mutable compact_table : bool;
   mutable copy_parent : bool;
   mutable clean_when_copying : bool;
   mutable retry_count : int;
   mutable bucket_small_size : int;
}
let params: params;

Statistics

type stats = {
   classes : int;
   methods : int;
   inst_vars : int;
}
let stats: unit => stats;