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

Simplify definition and override of constants in Object


    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: PUP 5.2.0
    • Component/s: None
    • Labels:
    • Release Notes:
      Not Needed
    • Release Notes Summary:
      Part of a larger feature (Pcore) that has not yet been officially released
    • QA Risk Assessment:
      No Action


      Before this, a constant in an Object required a full specification of an attribute setting kind to constant, and then specifying both value and type. This is in almost all cases excessive and makes simple definition of objects long.

      To make constants easier to define - it should be possible to specify constants with just name and value and let the data type of the value determine the constant's data type.

      This example:

      constants => { size => 10}

      is equivalent to the long form:

      attributes => { size => { kind => constant, type => Integer, value => 10} }

      The two forms are interchangeable.

      The inferred data type for the constant is made generic to the base data type. If a more restricted data type is wanted, the long form must be used. When overriding a constant with the same name in a parent type, the constant must be of a compliant type. When using the short form to override, the resulting data type is inherited from the base type. If a narrowing of the type is wanted when overriding the long form must be used.




            • Assignee:
              henrik.lindberg Henrik Lindberg
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created:

                Zendesk Support