Relation between: joo_global_object , Jv.global, Js.Unsafe.global

I am having trouble understanding how these three are related. Is it the case that:

  1. JS/joo_global_object == OCaml/Jv.global
    Intuition: These two lines seem to match up:
    jsoo-code-mirror/includes.js at bd1d3c68a23655cd667986aef48c05a6514fd194 · patricoferris/jsoo-code-mirror · GitHub
    jsoo-code-mirror/stream.ml at bd1d3c68a23655cd667986aef48c05a6514fd194 · patricoferris/jsoo-code-mirror · GitHub
    which would imply that JS/joo_global_object == OCaml/Jv.global

  2. JS/ == Js.Unsafe.global ?

The intuition here is from How to bind a JS library for OCaml , where the

Js.Unsafe.global##.document

would seem to imply that Js.Unsafe.global is the “highest root-ish global”

  1. Does this mean that Jv.global == Js.Unsafe.global##joo_global_object ?

This follows from 1 & 2, but looks weird.

Jv.global == Js.Unsafe.global

They are both defined to be equal to the js variable globalThis.

joo_global_object is an old deprecated name for globalThis.

1 Like