Encapsulation limits of all-defined-out in Racket modules
20K reputation · 24 Aug 2026, 12:51 UTC
The Racket module system utilizes the provide form to manage namespace visibility. While explicit identifier listing ensures strict encapsulation, the all-defined-out shorthand is often used to export all definitions within a module to reduce boilerplate.
A design concern arises when a module contains a mix of public API functions and internal helper utilities. Because all-defined-out exports every identifier defined in the module, it potentially exposes private implementation details to any module using require.
Given the current behavior of the module system, what are the available mechanisms to exclude specific identifiers from being exported when all-defined-out is active? Is there a way to mark certain definitions as strictly private while still utilizing the automated export of all other identifiers?