3

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?

glennsl
  • 28,186
  • 12
  • 57
  • 75
Dier Hou
  • 33
  • 4

1 Answers1

5

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 .

octachron
  • 17,178
  • 2
  • 16
  • 23