Skip to content

Semi-exported names

It's generally inadvisable to add exports to a well-known module because they may clash with existing code using the module and importing it in its entirety. As a work-around, I propose allowing a module to export a name that will only be visible in a module that lists it explicitly. If we had

module Foo (a, b, hidden c)

then simply

import Foo

would not bring c into scope, but

import Foo (c)

would bring in c (and nothing else). To get everything, we could use something like

import Foo revealing (c)

and to be a bit picky,

import Foo hiding (a) revealing (c).

Edited by David Feuer
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information