Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-523

Make it possible to declare classes, defines and functions (and more) as private to a module

    Details

    • Type: Epic
    • Status: Designing
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Language
    • Labels:
      None
    • Epic Name:
      5.x Module Privacy
    • Template:
    • Team/s:
      Platform Core
    • Story Points:
      2

      Description

      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:

      • functions
      • type aliases and defiitions
      • resources
      • classes
      • 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
        • Definitions
        • Clases
        • 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.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  henrik.lindberg Henrik Lindberg
                  QA Contact:
                  Kurt Wall
                • Votes:
                  4 Vote for this issue
                  Watchers:
                  15 Start watching this issue

                  Dates

                  • Created:
                    Updated: