Affects Version/s: None
Fix Version/s: None
Epic Name:5.x Module Privacy
In order to support Modularity it is important that module authors can define what they consider to be API and what is an internal implementation concern. In order to support this, the keyword 'private' has already been added to the lexer as a reserved word, but it currently has no functionality.
Something that is declared private in a module can only be used from within that module. Something that is declared private in an environment is not visible to modules in that environment.
We want to make the following things private:
- type aliases and defiitions
- variables in public classes (they are by definition private in private classes)
A number if things needs to be addressed in order for this to work:
- The 4.x loaders must support that modules contain a 'private' loader that contains things only visible to it.
- The 4.x loaders must be capable of loading
- 3.x functions (not absolutely required as there is no way to mark them as private, but there are other benefits of doing this)
- The grammar must be changed to support the private keyword in front of function, type alias, type definition, class, and define.
- The respective loader/creator of the above language elements need to place them in the private loader for the module (or the environment)
- Puppet Strings need to skip producing documentation; alternatively link them into a separate section that is optionally rendered.
- The language specification must be updated
- To support private variables in a public class, scope must know about private variables and hide them from external access.
- When doing so, it must support EPP and ERB templates and access from within the same module.
- The 4.x Ruby function API must be updated to allow 4.x functions in ruby to be declared as private.