Does `module%private` exist?


#1

I just found out this syntax:

let%private myValue = 1;

(see: https://reasonml.org/blog/bucklescript-release-7-2)

Does such a syntax exist for the modules ?
For example:

module%private MyPrivateModule = {
   type t = string;
   let name = "joseph maarek";
   // ...
};

It would be very convenient for aliasing module without export it.

module%private Image = React_Component_Image;

// ...
<Image id=123 />

#2

it exists in OCaml 4.08: https://github.com/ocaml/ocaml/pull/2122

If and when BuckleScript upgrades to (or above) that version, it will automatically get it.

EDIT; on second thought, this is not actually what you asked for, sorry. I think it only works in interface files.


#3

For ml file, you can use open struct ... end, the syntax in mli file is more restricted and amount essentially to private abbreviations.


#4

I logged a ticket about this at the time:

tl;dr is it’s not planned in the short term, but might happen eventually.