You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2019/02/16 10:51:00 UTC

[jira] [Commented] (GROOVY-8991) Difference in behaviour with closure and lambda

    [ 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)