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

Implementation of +=/-= is potentially confusing

    Details

    • Template:
    • Story Points:
      1
    • Sprint:
      2014-08-20

      Description

      It seems to me that += and -= are more confusing than useful, and I would argue that they simply shouldn't exist.

      Right now (with "--parser future"), these operators implicitly create a new variable that may shadow one from an outer scope, appending/removing the RHS to the outer scope variable if it exists. If the variable has already been defined in the current scope, the operation fails.

      In practice, this works like a kind of temporary mutation, or else it's just regular assignment, or else causes a failure. The alternative, using +/- with =, is more intuitive, less ambiguous, and sacrifices little if anything in terms of expressiveness.

      I apologize in advance if there's something major that I'm missing here, but I'd like to reopen the discussion on whether it's better to just remove these operators from the language.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                justin.holguin Justin Holguin
                QA Contact:
                Eric Thompson
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 hour
                    1h