The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #11911

Variables with {} should always work

Added by Hunter Haugen over 4 years ago. Updated over 3 years ago.

Status:DuplicateStart date:01/12/2012
Priority:NormalDue date:
Assignee:J.D. Welch% Done:

0%

Category:language
Target version:-
Affected Puppet version: Branch:
Keywords:variable, variables, curly, braces, brackets, parser

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

This works: $variable

This works: "${variable}"

This fails: ${variable}

It would be more consistent for curly braces/brackets {} around variables to work both inside and outside of double-quotes.


Related issues

Related to Puppet - Feature #3987: Allow ${var} with curlies everywhere Accepted 06/10/2010
Related to Puppet - Feature #1198: alter parser to throw an error on use of an undefined, un... Accepted

History

#1 Updated by Anonymous over 4 years ago

  • Category set to language
  • Status changed from Unreviewed to Accepted
  • Priority changed from Normal to Low

That is very true, and should work. Patches accepted, as it otherwise isn’t super-high priority.

#2 Updated by Anonymous about 4 years ago

  • Priority changed from Low to Normal

I disagree with “low” priority. This is a nasty speedbump to learning, and makes the language more fragile.

#3 Updated by Henrik Lindberg over 3 years ago

I disagree, the construct “${}” currently has the meaning interpolate expression value, and where a bare word is shorthand for variable. i.e. “${a}” is shorthand for “${$a}” – any expression is allowed “${$a + $b}” means add $a and $b and make a string of the result.

I would rather reserve the ${ } syntax for a future lambda construct (unnamed function) – i.e. a block of code that can be evaluated. (This fits well with the use in string interpolation where the current meaning can be expressed as “interpolate the result of evaluating this lambda taking no arguments”. (Lambdas would be really neat in combination with collection support). Thus $x = ${a} would mean that $x is a code block that needs to be evaluated (and it evaluates to the value of $a).

#4 Updated by Henrik Lindberg over 3 years ago

BTW, this was once supported in the grammar (it was referred to as “unquoted string”) but has been remove. Don’t know if it ever actually worked.

#5 Updated by Anonymous over 3 years ago

  • Assignee set to J.D. Welch

#6 Updated by Henrik Lindberg over 3 years ago

  • Status changed from Accepted to Duplicate

Marked as duplicate of #3987 (accept curlies everywhere).

Also available in: Atom PDF