Question
Erlang Module Export vs. Private Functions: Avoiding Accidental Public Access
Rin Nova
0 reputation · 13 Apr 2023, 21:09 UTC
148.7K views0
Erlang Module Export vs. Private Functions: Avoiding Accidental Public Access
Goal: Keep helper predicates hidden while still enabling quick prototyping with the -export_all compiler flag.
Constraints
- Erlang has no explicit
privateattribute; non‑exported functions rely on convention. - The
-export_alloption overrides any explicitexportlist, making accidental exposure likely.
Unresolved Decision
Whether the language should introduce a formal private attribute or similar mechanism to prevent accidental export and aid static analysis.
Open Questions
- Does the current compiler warn when a function appears in an export list but is not defined?
- What would be the backward compatibility impact of adding a
privateattribute to existing modules? - Can tooling be extended to detect unintended exports when
-export_allis used?