groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: How to determine the equality of two closures?
Date Thu, 13 Apr 2017 14:07:35 GMT


On 13.04.2017 15:56, bo zhang wrote:
> Hello everybody,
>
> I just have encountered a problem thus need your help. I want to treat
> the following closures as "equivalent":
>
> Clousure c1={
> "This is a closure"
> }
>
> Clousure c2={
> "This is a closure"
> }
>
> assert closureEqual(c1,c2)

may I ask how you want to use that? I was thinking about this in the 
past, but I failed to create a reasonable scenario in which I would need 
this.

> Apparently, even though all fields and methods (the internal bytecode)
> are equal, c1 and c2 are still different classes (xxx_closure$1 and
> xxx_closure$2). AFAIK, everything but name in these two classes are equal.
>
> Is there any possibilities to achieve my goal? Thank you very much.

right now, not no.

bye Jochen

Mime
View raw message