Open module syntax error


let abc: Hashtbl.t(string, string) = Hashtbl.create(5);

/* it’s ok */
abc->Hashtbl.add(“a1”, “value”);

/* it’s ok */
open Hashtbl;
add(abc, “c1”, “value”);
abc->add(“d1”, “value”);

/* it’s not ok */
add(abc, “b1”, “b1v”);
abc->abc(“b1”, “b1v”);

why? you can see about this in


There’s a typo in the last example - abc->abc(...) rather than abc->add(...). If that’s in the original code then that could be the issue.


You need a code block after the local open:

  add(abc, "b1", "b1v");
  abc->add("b1", "b1v");