What does "##" after variable mean?

85 views Asked by At

Js.coerce_opt (Dom_html.document##getElementById id)

I'm new to OCaml, and I'm dealing with Js_of_Ocaml recently. I've seen code as above that includes two pounds after between variable and function. What do they mean?

1

There are 1 answers

0
octachron On BEST ANSWER

Ordinary method calls for OCaml objects are written as obj#meth.

In order to handle Js objects, js_of_ocaml adds a (ppx) syntax extension that uses obj##meth for invoking methods for Js objects: https://ocsigen.org/js_of_ocaml/4.0.0/manual/ppx .