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

a given undef should set undef and not require a default expression of = undef

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.4.0
    • Component/s: Docs
    • Labels:
      None
    • Template:
    • Epic Link:
    • Story Points:
      1
    • Sprint:
      Language 2016-02-24
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Should be in the release notes together with the fix for PUP-5925.

      Description

      In PUP-5925 we made it possible to give an undef value in a data binding and allowing that to mean that undef is assigned to a class parameter if that class parameter does not have a default value expression (a default expression wins using the rule "an undef given value means 'use the default").

      This ticket asserts that we have the same behavior for a given undef - e.g.:

      define foo(Optional[Integer] $x) { }
      foo { 'example': x => undef }
      

      if executed this would not fail, and the user would get $x set to undef (just what PUP-5925 achieves).

      This means that the semantics changes from "use the default" to "use the default if there is one" . Since we now have typing, a user can protect against unwanted undef by using a type that does not accept undef for that parameter.

      This DOCs note is to ensure that this is documented correctly. (The implementation has worked this way for some time in the 4.x series).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              henrik.lindberg Henrik Lindberg
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support