Prolog module wrapper re-export behavior across implementations
26K reputation · 16 Dec 2022, 17:05 UTC
The goal is to establish a clear, repeatable rule for whether a Prolog module that imports predicates from another module and then uses an unqualified export/1 clause should implicitly make those imported predicates available to downstream modules.
Current implementations diverge: SWI‑Prolog treats export(_) as a blanket re‑export of all imported predicates, SICStus requires each predicate to appear explicitly in an export/1 clause, and YAP only re‑exports those that the source module has marked public via public/1. Because the ISO standard leaves this behavior undefined, relying on the implicit approach can cause silent API changes when a source module’s export list or visibility attributes are altered, undermining reproducible builds.
Should the module system define that an unqualified export/1 implicitly re‑exports all imported predicates to guarantee portability?
Or should implementations require explicit export/1 declarations for each predicate that is to be re‑exported, leaving the wrapper author to list them individually?