package-private visibility

This commit is contained in:
2026-08-01 22:55:35 +02:00
parent 304880a9aa
commit f267e8c3cb
11 changed files with 301 additions and 185 deletions
+4 -4
View File
@@ -842,13 +842,13 @@
- this keeps package lookup shallow and deterministic and avoids overloading import aliases with
declaration visibility
36.5. explicit `hide` file-local declarations (implemented)
36.5. explicit `hide` package-local declarations (implemented)
- `hide name ...` gives any named top-level function, global, native/C record, union, enum,
opaque/distinct type, or declaration/type alias the existing file-local semantics
opaque/distinct type, or declaration/type alias package-local visibility across sibling files
- declarations remain public by default; a leading underscore is an ordinary identifier and `_`
remains the write-only sink
- hidden native and C declarations with the same name may coexist in separate files, while public
collisions are still diagnosed
- hidden declarations occupy the package namespace, collide with sibling declarations of the
same name, and remain absent from imported package namespaces
- `hide` is reserved for named top-level declarations and is rejected on imports, locals,
parameters, fields, and anonymous declarations