groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Sun (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-8991) Difference in behaviour with closure and lambda
Date Sat, 16 Feb 2019 10:51:00 GMT

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

Daniel Sun commented on GROOVY-8991:
------------------------------------

"I believe this difference is quite unexpected."

Yep. According to the original design, lambda's precedence should be same to closure's, thus
they should be parsed to same AST result.

 

> Difference in behaviour with closure and lambda
> -----------------------------------------------
>
>                 Key: GROOVY-8991
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8991
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 3.0.0-alpha-4
>            Reporter: Alexey Afanasiev
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 3.0.0-alpha-5
>
>
> {code}
> foo {
>   closure
> }
> .bar {
>   closure2
> }
> //produced binary like
> this.foo({ 
>     return closure 
> }).bar({ 
>     return closure2 
> })
> {code}
> but
> {code}
> foo ()->{
>   closure
> }
> .bar ()->{
>   closure2
> }
> //produced binary like
> this.foo({ 
>     return closure 
> }.bar).{ 
>     return closure2 
> }
> {code}
> I believe this difference is quite unexpected.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message