What is the purpose of this file ext_marshal.ml in the compiler where we see this code:
(*
let to_file filename v =
let chan = open_out_bin filename in
Marshal.to_channel chan v [];
close_out chan
(** [bin] mode for WIN support *)
let from_file filename =
let chan = open_in_bin filename in
let v = Marshal.from_channel chan in
close_in chan;
v *)
external from_bytes_unsafe: string -> int -> 'a
= "caml_input_value_from_string"
let from_string_uncheck (s:string) =
from_bytes_unsafe s 0
More generally, what is the purpose of the lib/js directory?
lib/js files
arg.js camlinternalBigarray.js
array.js camlinternalFormat.js
arrayLabels.js camlinternalFormatBasics.js
belt.js camlinternalLazy.js
belt_Array.js camlinternalMod.js
belt_Float.js camlinternalOO.js
belt_HashMap.js char.js
belt_HashMapInt.js complex.js
belt_HashMapString.js curry.js
belt_HashSet.js digest.js
belt_HashSetInt.js dom.js
belt_HashSetString.js dom_storage.js
belt_Id.js dom_storage2.js
belt_Int.js filename.js
belt_List.js format.js
belt_Map.js genlex.js
belt_MapDict.js hashtbl.js
belt_MapInt.js int32.js
belt_MapString.js int64.js
belt_MutableMap.js js.js
belt_MutableMapInt.js js_OO.js
belt_MutableMapString.js js_array.js
belt_MutableQueue.js js_array2.js
belt_MutableSet.js js_cast.js
belt_MutableSetInt.js js_console.js
belt_MutableSetString.js js_date.js
belt_MutableStack.js js_dict.js
belt_Option.js js_exn.js
belt_Range.js js_float.js
belt_Result.js js_global.js
belt_Set.js js_int.js
belt_SetDict.js js_json.js
belt_SetInt.js js_list.js
belt_SetString.js js_mapperRt.js
belt_SortArray.js js_math.js
belt_SortArrayInt.js js_null.js
belt_SortArrayString.js js_null_undefined.js
belt_internalAVLset.js js_obj.js
belt_internalAVLtree.js js_option.js
belt_internalBuckets.js js_promise.js
belt_internalBucketsType.js js_re.js
belt_internalMapInt.js js_result.js
belt_internalMapString.js js_string.js
belt_internalSetBuckets.js js_string2.js
belt_internalSetInt.js js_typed_array.js
belt_internalSetString.js js_typed_array2.js
buffer.js js_types.js
bytes.js js_undefined.js
bytesLabels.js js_vector.js
callback.js lazy.js
caml_array.js lexing.js
caml_array_extern.js list.js
caml_bytes.js listLabels.js
caml_exceptions.js map.js
caml_external_polyfill.js marshal.js
caml_float.js moreLabels.js
caml_float_extern.js node.js
caml_format.js node_buffer.js
caml_gc.js node_child_process.js
caml_hash.js node_fs.js
caml_hash_primitive.js node_module.js
caml_int32.js node_path.js
caml_int32_extern.js node_process.js
caml_int64.js obj.js
caml_int64_extern.js parsing.js
caml_io.js pervasives.js
caml_js_exceptions.js printexc.js
caml_lexer.js printf.js
caml_md5.js queue.js
caml_module.js random.js
caml_nativeint_extern.js scanf.js
caml_obj.js set.js
caml_oo.js sort.js
caml_oo_curry.js stack.js
caml_option.js stdLabels.js
caml_parser.js std_exit.js
caml_primitive.js stream.js
caml_splice_call.js string.js
caml_string.js stringLabels.js
caml_string_extern.js sys.js
caml_sys.js uchar.js
caml_undefined_extern.js
For example, I see often caml_gc in some old code. Like in bs-batteries which ported batteries-included lib to js sometime ago. caml_*.js
files dont seem available to us to be used while other files in this directory like the belt_*.js
files are available to us.
Do the caml_*.js
files have some equivalent in belt
?
Sorry for the kinda general vague question. I am trying to understand the more deeply what the compiler is doing.
Thank you.