-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Module aliasing and ability to reference the current and parent modules #6324
Description
Original bug ID: 6324
Reporter: pw374
Status: acknowledged (set by @damiendoligez on 2014-07-16T13:29:05Z)
Resolution: open
Priority: normal
Severity: feature
Category: typing
Related to: #6323
Monitored by: @hcarty @yakobowski
Bug description
I've always wanted to be able to reference the current module, which also means being able to reference the parent module(s).
An idea is to be allowed to prefix a type or a variable with the current module's name.
As in
module X = struct type t = A let a : X.t = A end
However this would probably break existing programs, or worse: change their semantics, so let's drop it.
But by using a new syntax, we could have this without breaking preexisting programs:
module X as Y = struct type t = A let a : Y.t = A end
and I believe it would be quite useful!
Perhaps the keyword as is not the best, that can certainly be discussed.
Additional information
It's related to #6323
as this feature would allow the programmer to fairly easily solve an impossible problem (i.e., the fact that currently some working .ml files just cannot have an .mli that matches its full interface).