Jira (PUP-5764) Support a single _ to mean ignored parameter

20 views
Skip to first unread message

Henrik Lindberg (JIRA)

unread,
Jan 28, 2016, 1:10:12 PM1/28/16
to puppe...@googlegroups.com
Henrik Lindberg created an issue
 
Puppet / Improvement PUP-5764
Support a single _ to mean ignored parameter
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2016/01/28 10:09 AM
Priority: Normal Normal
Reporter: Henrik Lindberg

It is of value to be able to define that a parameter should be ignored. This helps in situations where a lambda needs to have several parameters, but only some of them are actually needed. The user must otherwise name the parameter. Code checking (that we do not have yet though) would then find a declared parameter that is unused.

Using a _ instead of a parameter name also serves as a clear indication that it is ignored.

There should be no problems introducing a single _ as a keyword as that is not a meaningful bare word,

Here is an example:

{a => 10, b => 20}.each |$key, _ | { notice $key }

There are other uses cases for the single underscore, it does not always mean ignore, it can also be used as place to put a single injected values, and other use cases. The _ alone should be thought of as anonymous identifier or "Jane Doe".

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.12#64027-sha1:e3691cc)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
May 17, 2016, 9:00:03 PM5/17/16
to puppe...@googlegroups.com
Henrik Lindberg commented on Improvement PUP-5764
 
Re: Support a single _ to mean ignored parameter

An alternative is to accept that a parameter that only has a type is the same as entering _

This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
May 17, 2016, 9:01:04 PM5/17/16
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
 
Change By: Henrik Lindberg
Fix Version/s: PUP 4.6.0

Henrik Lindberg (JIRA)

unread,
Jul 18, 2016, 4:09:04 AM7/18/16
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Fix Version/s: PUP 4.6.0
Fix Version/s: PUP 4.y

Henrik Lindberg (JIRA)

unread,
Sep 7, 2016, 6:12:32 PM9/7/16
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Team: Puppet Developer Support
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 9:23:02 AM5/16/17
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 9:23:05 AM5/16/17
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Fix Version/s: PUP 4.y

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 9:24:02 AM5/16/17
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Component/s: Language

David McTavish (Jira)

unread,
Dec 6, 2021, 11:15:01 AM12/6/21
to puppe...@googlegroups.com
David McTavish updated an issue
Change By: David McTavish
Labels: final_triage
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

David McTavish (Jira)

unread,
Dec 6, 2021, 1:28:03 PM12/6/21
to puppe...@googlegroups.com
David McTavish updated an issue
Change By: David McTavish
Priority: Normal Low

David McTavish (Jira)

unread,
Dec 22, 2021, 1:24:01 PM12/22/21
to puppe...@googlegroups.com
David McTavish updated an issue
Change By: David McTavish
Team: Froyo
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages