[ 
https://issues.apache.org/jira/browse/GROOVY-10943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17694293#comment-17694293
 ] 

ASF GitHub Bot commented on GROOVY-10943:
-----------------------------------------

codecov-commenter commented on PR #1867:
URL: https://github.com/apache/groovy/pull/1867#issuecomment-1447538195

   # 
[Codecov](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#1867](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 (81e5bb3) into 
[master](https://codecov.io/gh/apache/groovy/commit/c27927c1e99f9f814aea9fe26fb85c4e3a624978?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 (c27927c) will **increase** coverage by `0.0106%`.
   > The diff coverage is `93.3333%`.
   
   > :exclamation: Current head 81e5bb3 differs from pull request most recent 
head 4db1f34. Consider uploading reports for the commit 4db1f34 to get more 
accurate results
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/groovy/pull/1867/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #1867        +/-   ##
   ==================================================
   + Coverage     68.0935%   68.1041%   +0.0105%     
   - Complexity      28610      28625        +15     
   ==================================================
     Files            1427       1428         +1     
     Lines          113115     113143        +28     
     Branches        19338      19341         +3     
   ==================================================
   + Hits            77024      77055        +31     
     Misses          29600      29600                
   + Partials         6491       6488         -3     
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 | Coverage Δ | |
   |---|---|---|
   | 
[...va/org/apache/groovy/parser/antlr4/AstBuilder.java](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L0FzdEJ1aWxkZXIuamF2YQ==)
 | `86.8117% <80.0000%> (+0.0176%)` | :arrow_up: |
   | 
[...rg/codehaus/groovy/control/PlaceholderVisitor.java](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvUGxhY2Vob2xkZXJWaXNpdG9yLmphdmE=)
 | `94.7368% <94.7368%> (ø)` | |
   | 
[...codehaus/groovy/classgen/VariableScopeVisitor.java](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL1ZhcmlhYmxlU2NvcGVWaXNpdG9yLmphdmE=)
 | `94.5122% <100.0000%> (+0.0337%)` | :arrow_up: |
   | 
[...a/org/codehaus/groovy/control/CompilationUnit.java](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvQ29tcGlsYXRpb25Vbml0LmphdmE=)
 | `80.6584% <100.0000%> (+0.1605%)` | :arrow_up: |
   | 
[...vy/util/concurrent/ConcurrentReferenceHashMap.java](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS91dGlsL2NvbmN1cnJlbnQvQ29uY3VycmVudFJlZmVyZW5jZUhhc2hNYXAuamF2YQ==)
 | `36.0738% <0.0000%> (+0.5034%)` | :arrow_up: |
   | 
[...org/codehaus/groovy/vmplugin/v8/IndyInterface.java](https://codecov.io/gh/apache/groovy/pull/1867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3ZtcGx1Z2luL3Y4L0luZHlJbnRlcmZhY2UuamF2YQ==)
 | `86.0656% <0.0000%> (+0.8197%)` | :arrow_up: |
   




> Consider additional use of _ as a placeholder
> ---------------------------------------------
>
>                 Key: GROOVY-10943
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10943
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>              Labels: GEP
>
> Recent Java versions make underscore, "_", an illegal variable name. This is 
> to allow it to be used as a placeholder as per JEP 302: Lambda Leftovers[1]. 
> This issue is to explore how better to have such a placeholder in Groovy.
> This strengthens an informal convention already in use. Instead of writing 
> this:
> {code}
> def (coordX, coordY, unusedZ) = coord3D()
> {code}
> Sometimes it is written as:
> {code}
> def (coordX, coordY, _) = coord3D()
> {code}
> Currently, the underscore is a variable and could be used but the convention 
> is that
> it would be ignored.
> This convention doesn't scale if more than one result is to be ignored (here 
> a double underscore is used for the second ignored result):
> {code}
> def (coordX, coordY, _, __) = coord3DwithColor()
> {code}
> This idea being that the following should be valid:
> {code}
> def (coordX, coordY, _, _) = coord3DwithColor()
> {code}
> Which currently gives an error for the duplicated variable name.
> Another example:
> {code}
> def (x, _, y, _, z) = 1..5
> assert "$x $y $z" == '1 3 5'
> {code}
> Similarly, the idea is applicable for lambda parameters (as per the example 
> in the previously mentioned Java JEP):
> {code}
> BiFunction<Integer, String, String> biss = (i, _) -> String.valueOf(i)
> {code}
> We could follow Java's lead and make underscore an invalid variable name but 
> it might be possible to keep uses of that name except where there is more 
> than one occurrence of the name. In such a circumstance, use of the name 
> would no longer reference a variable. We need to check the impacts of 
> shadowing as per discussions in the JEP.
>  [1] [https://openjdk.org/jeps/302]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to