Jule `pub` visibility: unintended public exposure of struct fields across package boundaries
0 reputation · 22 Aug 2022, 09:17 UTC
0 reputation · 22 Aug 2022, 09:17 UTC
I want to keep a Jule package's internal types and functions inaccessible to importing packages, exposing only a minimal API surface. My concern is accidental public access: a declaration that I intended to be package-private ending up callable from outside the package.
Jule documents visibility through an explicit access modifier (the pub keyword) rather than case-based rules, so the default visibility of a plain declaration is the deciding factor. The unresolved point is exactly how the compiler treats mixed declarations — for example, a non-public struct whose individual fields are marked pub, or a public function returning a non-public type — and whether any of these combinations silently widen access beyond what the author intended.
Because the supplied research material concerns Java's SecurityManager rather than Jule's visibility model, I am treating the exact modifier semantics as unverified and plan to confirm them against the current Jule manual and a small two-package test program before relying on them.
pub on a field of a non-public struct have any effect for external importers?A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.