Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2023-05-15 Thread Henrik Lindberg (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Henrik Lindberg commented on  PUP-11066  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
 The proposal to make all optional_parameter wrap the type in Optional is bad because it would break the contract of the function API and possibly deliver undef values to functions that are not implemented to handle that.   As Josh pointed out, it is easy to get confused because "optionality" differs depending on context. I regret that we named the "also accepts undef" data type Optional, we were debating several names like Nullable[T], Undefable[T], and Maybe[T]. We also discussed if Undef[T] made sense or not. Unfortunately, it is way too late to make such a change.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)  
 
 

 
   
 

  
 

  
 

   





-- 
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.399614.1621017826000.13238.1684139940023%40Atlassian.JIRA.


Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2023-05-10 Thread john (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 john commented on  PUP-11066  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
 Ciprian Badescu can yuo provide more information why this bug was closed as wont fix. it seems like the last update from Josh Cooper proposed a solution that could work i.e.   
 
 
 
 
 def optional_param(type, name)  
 
 
   internal_param(Puppet::Pops::Types::TypeFactory.optional(type), name)  
 
 
   @max += 1  
 
 
 end
  
 
 
 
  however i dont see any reason why that solution and this bug was rejected  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)  
 
 

 
   
 


Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2021-10-11 Thread Lucy Voigt (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Lucy Voigt commented on  PUP-11066  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
 That makes total sense Josh. Should I just close this issue?  
 

  
 
 
 
 

 
 
 

 
 
 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.399614.1621017826000.152276.1633991760035%40Atlassian.JIRA.


Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2021-09-27 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-11066  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
 I think this is a case where 'optional' means different things in optional_param and Optional[T]. The former marks the parameter as an optional positional argument, while the latter is the type specification for the parameter, and Optional[T] will match either T or surprisingly Undef. See https://puppet.com/docs/puppet/7/lang_data_undef.html and https://tickets.puppetlabs.com/browse/PUP-8101?focusedCommentId=502043=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-502043 So if I have a wait function:  
 
 
 
 
 Puppet::Functions.create_function(:wait, Puppet::Functions::InternalFunction) do  
 
 
   dispatch :wait do  
 
 
 optional_param 'Integer[1]', :timeout  
 
 
   end  
 
 
    
 
 
   def wait(timeout = nil)  
 
 
 puts "timeout #{timeout.inspect}"  
 
 
   end  
 
 
 end
  
 
 
 
  Then I can omit the timeout parameter due to optional_param:  
 
 
 
 
 $ bx puppet apply -e 'wait()'   

Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2021-09-07 Thread Ciprian Badescu (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Ciprian Badescu updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-11066  
 
 
  optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
Change By: 
 Ciprian Badescu  
 
 
Sprint: 
 Triaged tickets  
 

  
 
 
 
 

 
 
 

 
 
 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.399614.1621017826000.123957.1631003220036%40Atlassian.JIRA.


Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2021-05-18 Thread Lucy Wyman (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Lucy Wyman commented on  PUP-11066  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
 Definitely not a blocker since we can just use `optional_param 'Optional[Integer]'`, works just as expected. No rush on our end, just didn't want to forget to make a ticket for it.  
 

  
 
 
 
 

 
 
 

 
 
 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.399614.1621017826000.35223.1621355760031%40Atlassian.JIRA.


Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2021-05-18 Thread Mihai Buzgau (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mihai Buzgau updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-11066  
 
 
  optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
Change By: 
 Mihai Buzgau  
 
 
Team: 
 Night's Watch  
 

  
 
 
 
 

 
 
 

 
 
 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.399614.1621017826000.35087.1621349700028%40Atlassian.JIRA.


Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2021-05-18 Thread Mihai Buzgau (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mihai Buzgau updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-11066  
 
 
  optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
Change By: 
 Mihai Buzgau  
 
 
Sprint: 
 Triaged tickets  
 

  
 
 
 
 

 
 
 

 
 
 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.399614.1621017826000.35086.1621349640033%40Atlassian.JIRA.


Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2021-05-18 Thread Mihai Buzgau (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mihai Buzgau updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-11066  
 
 
  optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
Change By: 
 Mihai Buzgau  
 

  
 
 
 
 

 
 With a custom ruby function with the following definition, passing `nil` to Timeout errors:{ { code} } Puppet::Functions.create_function(:wait, Puppet::Functions::InternalFunction) do  dispatch :wait doparam 'Variant[Future, Array[Future]]', :futuresoptional_param 'Integer[1]', :timeoutoptional_param 'Hash[String[1], Any]', :optionsreturn_type 'Array[Boltlib::PlanResult]'  end  def wait(futures, timeout = nil, options = {}){ { code} }   Inspecting the types that Puppet expects for the function indicates that the timeout is `PIntegerType`, not optional.With the following definition, the function has the correct signature:{ { code} } Puppet::Functions.create_function(:wait, Puppet::Functions::InternalFunction) do  dispatch :wait doparam 'Variant[Future, Array[Future]]', :futuresoptional_param 'Optional[Integer[1]]', :timeoutoptional_param 'Hash[String[1], Any]', :optionsreturn_type 'Array[Boltlib::PlanResult]'  end  def wait(futures, timeout = nil, options = {}){ { code} }  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

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

 
   

Jira (PUP-11066) optional_param does not set Integer to optional for custom ruby functions

2021-05-14 Thread Lucy Wyman (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Lucy Wyman created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-11066  
 
 
  optional_param does not set Integer to optional for custom ruby functions   
 

  
 
 
 
 

 
Issue Type: 
  Task  
 
 
Assignee: 
 Unassigned  
 
 
Created: 
 2021/05/14 11:43 AM  
 
 
Priority: 
  Normal  
 
 
Reporter: 
 Lucy Wyman  
 

  
 
 
 
 

 
 With a custom ruby function with the following definition, passing `nil` to Timeout errors: code Puppet::Functions.create_function(:wait, Puppet::Functions::InternalFunction) do dispatch :wait do param 'Variant[Future, Array[Future]]', :futures optional_param 'Integer[1]', :timeout optional_param 'Hash[String[1], Any]', :options return_type 'Array[Boltlib::PlanResult]' end  def wait(futures, timeout = nil, options = {}) code Inspecting the types that Puppet expects for the function indicates that the timeout is `PIntegerType`, not optional. With the following definition, the function has the correct signature: code Puppet::Functions.create_function(:wait, Puppet::Functions::InternalFunction) do dispatch :wait do param 'Variant[Future, Array[Future]]', :futures optional_param 'Optional[Integer[1]]', :timeout optional_param 'Hash[String[1], Any]', :options return_type 'Array[Boltlib::PlanResult]' end  def wait(futures, timeout = nil, options = {}) code  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment