check what a module's importers can see of its types

An importer is given the pub forms and nothing else, so a pub form
naming a private type, or one from an import without pub, compiled in
its module and failed in every importer with `unknown type name'.

The pub forms are checked as the module itself is compiled. A record,
struct, union or sum behind a pointer needs only declaring, so its
bodyless declaration goes out ahead of them -- the opaque handle that
(pub record T) already gave by hand. Held by value it needs its body,
and a typedef or an enum has no declaration short of its definition:
those are errors at the pub form, saying what would do instead. A name
Sex has no declaration for is left to C.

An importer may now be handed a declaration after the definition it
declares, so a bodyless aggregate no longer replaces known fields.

Fixes #57, #58.
This commit is contained in:
2026-10-09 17:43:09 +03:00
parent 2d4e5f6b16
commit 360470d0e0
9 changed files with 323 additions and 17 deletions

View File

@@ -1,5 +1,6 @@
(module sex-modules
(get-modules-public-forms
load-persistent-module-paths
check-public-interface
read-public-interface)
"sex-modules.scm")