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

Improve separation of concern between String and Enum types

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.8.0
    • Fix Version/s: PUP 4.9.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Team:
      Puppet Developer Experience
    • Story Points:
      1
    • Sprint:
      PDS 2016-11-30
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      The Internal Ruby API for String and Enum types have been slightly modified as the Enum type is now used for inferred result of multiple Strings. The change is public API backwards compatible but issues deprecation warnings.
      If coding in Ruby against the type system, turn on (at least) strict=warning to see deprecations.
      Show
      The Internal Ruby API for String and Enum types have been slightly modified as the Enum type is now used for inferred result of multiple Strings. The change is public API backwards compatible but issues deprecation warnings. If coding in Ruby against the type system, turn on (at least) strict=warning to see deprecations.
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      ruby API, covered well by unit tests

      Description

      This ticket is about Puppet Type internals and what's proposed here does not affect how the types are declared or represented.

      Today, the String type is designed to hold an array of string values and a Integer type (a range) that denotes the size. The values are never made visible and only the size can be declared as a parameter to the String type.

      The combination of the values and size attributes introduces two ambiguities in the type system.

      1. Today, both the size and the values constraints are enforced. This is unnecessary since the only way to create a String type that contain a value is by inference and the inference will set the size to match the contained value.
      2. Having a String type that represents multiple string values is 100% analog to using an Enum. So why both?

      It would make more sense if the String type could contain one single constraint. A value or a size. I.e. if the size is explicitly given, there should be no value. Conversely, a String type inferred from a string would have no size since it's implied by the value.

      A String that contains multiple values is currently created when the element type of a collection is reduced from multiple strings. The reduced type should instead be an Enum.

      The change would make the footprint of String type instances smaller which might be significant given the number of strings used as parameters or return values in calls (where they are inferred) in the system.

      The change would also make the serialization of a String type more efficient. Only one parameter would be serialized. It would be either the value or the size. Never both.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                thomas.hallgren Thomas Hallgren
                QA Contact:
                Eric Thompson
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support