Does `module%private` exist?


I just found out this syntax:

let%private myValue = 1;


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 />


it exists in OCaml 4.08:

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.


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


I logged a ticket about this at the time:

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


yes it exisits:-
A private-module-fragment ends the portion of the module interface unit that can affect the behavior of other translation units. A private-module-fragment allows a module to be represented as a single translation unit without making all of the contents of the module reachable to importers. The presence of a private-module-fragment affects:
the point by which the definition of an exported inline function is required ([dcl.inline])
the point by which the definition of an exported function with a placeholder return type is required ([])
whether a declaration is required not to be an exposure ([]),
where definitions for inline functions and templates must appear ([basic.def.odr], [dcl.inline], [temp.pre]),
the instantiation contexts of templates instantiated before it ([module.context]), and
the rachability of declarations within it ([module.reach]).


It is a copy/past of section of this link

This link is about C++ module, not ocaml, reasonml, rescript / bucklescript.


Is it some kind of chatbot?