On Sun, Apr 13, 2014 at 9:42 AM, David Banas <capn.freako@gmail.com> wrote:
Is this possible? That is, is it possible to provide different export lists to “friendly” vs. “unknown” client code?

Not directly. The usual convention is you put all your definitions in a .Internal module which is understood to be intended only for restricted use, although there is currently no way to enforce this; the public module(s) then imports that and re-exports the public interface.

It might be interesting to have some way to enforce this, possibly by a generalization of the Safe mechanism. It's not clear how well this can be enforced, in any case; if it's available across modules at all, there will be some way for "untrusted" code to get at it. I'm not sure anyone wants to pay the costs of complexity (in particular of cross-platform, which is already somewhat dicey at times) or limited flexibility to provide harder guarantees; in particular, there are times when you really do need access to another package's internals, with the result that some packages that used to hide their internals completely are now starting to export Internals modules.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net