Jira (PUP-8410) It is difficult to return a hash from a plan, or function

2021-06-11 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-8410  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: It is difficult to return a hash from a plan, or function   
 

  
 
 
 
 

 
 I'm going to close this as a dup of 6832.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.234238.1517437181000.55220.1623456840078%40Atlassian.JIRA.


Jira (PUP-8410) It is difficult to return a hash from a plan, or function

2021-06-10 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-8410  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: It is difficult to return a hash from a plan, or function   
 

  
 
 
 
 

 
 FWIW the hash vs resource _expression_ issue is filed as PUP-6832  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.234238.1517437181000.54208.1623366120032%40Atlassian.JIRA.


Jira (PUP-8410) It is difficult to return a hash from a plan, or function

2018-02-01 Thread Alex Dreyer (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Dreyer commented on  PUP-8410 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: It is difficult to return a hash from a plan, or function  
 
 
 
 
 
 
 
 
 
 
Why is the string case harder to parse than the name/implicit string case? 
 
 
 
 
 
 
return { title : } 
 
 
 
 
return { 'title' : } 
 
 
 
 
return { key => val } 
 
 
 
 
  
 
 
 
 
Why can't this be parse similarly? 
 
 
 
 
return { 'key' => val }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA 

Jira (PUP-8410) It is difficult to return a hash from a plan, or function

2018-02-01 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8410 
 
 
 
  It is difficult to return a hash from a plan, or function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Henrik Lindberg 
 
 
 

Summary:
 
 It is difficult to return a hash from a plan , or function 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8410) It is difficult to return a hash from a plan

2018-02-01 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-8410 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: It is difficult to return a hash from a plan  
 
 
 
 
 
 
 
 
 
 
Note that there is nothing specific to plans or return in this issue, the same problem exists for all functions that may be called without parentheses, and for code anywhere (not just in plans). 
Unfortunately, not much we can do about that - the root cause is the ambiguity caused by the resource expressions in the puppet language that the parsing technology we use cannot solve as it does not have lookahead that reaches more than one token. I don't see us changing the resource expressions or changing parser technology any time soon. 
What could be possible is to make return a keyword (now it is just a function like all others). When doing so, all other functions that may be called without parentheses (include, require, fail, info, notice, next, break, etc.) should then probably also receive the same treatment. The problem with new keywords is that they must then be handled in multiple other places as if they were just a regular "name" tokens. This means cost of fixing is relatively high and somewhat risky (as proved by similar changes made in the past causing bugs to escape into a released puppet version). We already have the list of special functions and I see no real harm in changing how "functions that may be called without parentheses" is actually implemented as we already have this ugly special case. 
Since Puppet 5.4.0 it is possible to drop the braces around hash entries when they appear as arguments to a function - so this can be used: 
 
 
 
 
 
 
return( result => 10 ) # unquoted 
 
 
 
 
return( 'result' => 10 ) # quoted
 
 
 
 
 
 
 
which is a small improvement in reduction of required punctuation. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 
   

Jira (PUP-8410) It is difficult to return a hash from a plan

2018-01-31 Thread Alex Dreyer (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Dreyer updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8410 
 
 
 
  It is difficult to return a hash from a plan  
 
 
 
 
 
 
 
 
 

Change By:
 
 Alex Dreyer 
 
 
 
 
 
 
 
 
 
 In some cases it's desirable to return a hash from a plan. It's easy to fall into  parser  syntax  errors when doing this however. Either Declaring a hash with quoted string keys as the implicit return or passing a hash with quoted string keys to "return" without parens both result in a syntax errorPlans that seem like they should work:{code}plan foo {    $result = run_task( ... )  { 'result' => $result }}plan foo {  return { 'result' => 10 }}{code}workarounds{code}plan foo {    $result = run_task( ... );  { 'result' => $result }}plan foo {  return  { result => 10 }}plan foo {  return ({ 'result' => 10 })}{code} 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8410) It is difficult to return a hash from a plan

2018-01-31 Thread Alex Dreyer (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Dreyer updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8410 
 
 
 
  It is difficult to return a hash from a plan  
 
 
 
 
 
 
 
 
 

Change By:
 
 Alex Dreyer 
 
 
 
 
 
 
 
 
 
 In some cases it's desirable to return a hash from a plan.  The most common ways  It's easy  to  accomplish that cause the Hash to be parsed as  fall into parser errors when doing this however. Either Declaring  a  block  hash with quoted string keys as the implicit return  or  resource declaration and  passing a hash with quoted string keys to "return" without parens both  result in a syntax error . Plans that seem like they should work:{code}plan foo {    $result = run_task( ... )  { 'result' => $result }}plan foo {  return { 'result' => 10 }}{code}workarounds{code}plan foo {    $result = run_task( ... );  { 'result' => $result }}plan foo {  return({ 'result' => 10 })}{code} 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8410) It is difficult to return a hash from a plan

2018-01-31 Thread Alex Dreyer (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Dreyer updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8410 
 
 
 
  It is difficult to return a hash from a plan  
 
 
 
 
 
 
 
 
 

Change By:
 
 Alex Dreyer 
 
 
 
 
 
 
 
 
 
 In some cases it's desirable to return a hash from a plan. The most common ways to accomplish that cause the Hash to be parsed as a block  or resource declaration  and result in a syntax error.Plans that seem like they should work:{code}plan foo {    $result = run_task( ... )  { 'result' => $result }}plan foo {  return { 'result' => 10 }}{code}workarounds{code}plan foo {    $result = run_task( ... );  { 'result' => $result }}plan foo {  return({ 'result' => 10 })}{code} 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8410) It is difficult to return a hash from a plan

2018-01-31 Thread Alex Dreyer (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Dreyer created an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8410 
 
 
 
  It is difficult to return a hash from a plan  
 
 
 
 
 
 
 
 
 

Issue Type:
 
  Bug 
 
 
 

Assignee:
 

 Unassigned 
 
 
 

Created:
 

 2018/01/31 2:19 PM 
 
 
 

Priority:
 
  Normal 
 
 
 

Reporter:
 
 Alex Dreyer 
 
 
 
 
 
 
 
 
 
 
In some cases it's desirable to return a hash from a plan. The most common ways to accomplish that cause the Hash to be parsed as a block and result in a syntax error. 
Plans that seem like they should work: 
 
 
 
 
 
 
plan foo { 
 
 
 
 
   
 
 
 
 
  $result = run_task( ... ) 
 
 
 
 
  { 'result' => $result }