Re: About native support for lazy constants

2020-01-12 Thread Daniel Sun
Hi Rémi,

> - if you want the bytecode getstatic to access the field, here you need the VM
>   to be changed, it's in the roadmap for the VM but not yet implemented

I wish we could still access the constants with bytecode getstatic, which is 
simple enough for us to use and read, but I do not know which version of Java 
will support the feature. Luckily, no rush to have the native lazy constants 
support, we can wait ;-)

Thanks for your suggestions and detailed explaination.

Cheers,
Daniel.Sun
On 2020/01/12 15:19:08, Remi Forax  wrote: 
> Several things to know:
> - you can rewrite all access to a field marked @Lazy to use a constant 
> dynamic,
>   that part can already be implemented. If you want to keep the compatibility
>   with Java 8, it means that you have to have two translations one for Java 
> 11+
>   and one for Java 10-.
> - if you want the bytecode getstatic to access the field, here you need the VM
>   to be changed, it's in the roadmap for the VM but not yet implemented
> - you don't care about getstatic because you can simulate it with an indy*
>   (which means that even with @CompileStatic you will use indy)
>   in that case you can implement it but it means that all codes that use
>   a combination of @Lazy + @CompileStatic has to be recompiled.
> 
> Rémi
> 
> * there is actually no support of ldc constantdynamic in java.lang.invoke.
> 
> 
> - Mail original -
> > De: "sunlan" 
> > À: "dev" 
> > Envoyé: Dimanche 12 Janvier 2020 13:34:22
> > Objet: About native support for lazy constants
> 
> > Hi all,
> > 
> >  I read an article[1] about the new features of Java 11 just now, and
> > find "JEP 309: Dynamic Class-File Constants"[2] can help us implement lazy
> > constants elegantly, e.g. `@Lazy static final Object SOME_LAZY_CONST =
> > `. The feature is very useful, so I propose to add *native*
> > support for lazy constants in some future version of Groovy.
> > 
> >  Any thoughts?
> > 
> > Cheers,
> > Daniel.Sun
> > [1]
> > https://javabeginnerstutorial.com/core-java-tutorial/java-11-new-features/
> > [2] https://openjdk.java.net/jeps/309
> > 
> > 
> > 
> > -
> > Apache Groovy committer & PMC member
> > Blog: http://blog.sunlan.me
> > Twitter: @daniel_sun
> > 
> > --
> > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
> r
> 


Re: About native support for lazy constants

2020-01-12 Thread MG

Hi Daniel,

I have no technical input, but I use @Lazy all the time, it's a great 
Groovy feature to avoid boilderplate code - so making it (internally) 
better sounds like a good idea, if it is not too much effort G-)


Cheers,
mg


On 12/01/2020 13:34, Daniel.Sun wrote:

Hi all,

   I read an article[1] about the new features of Java 11 just now, and
find "JEP 309: Dynamic Class-File Constants"[2] can help us implement lazy
constants elegantly, e.g. `@Lazy static final Object SOME_LAZY_CONST =
`. The feature is very useful, so I propose to add *native*
support for lazy constants in some future version of Groovy.

   Any thoughts?

Cheers,
Daniel.Sun
[1]
https://javabeginnerstutorial.com/core-java-tutorial/java-11-new-features/
[2] https://openjdk.java.net/jeps/309



-
Apache Groovy committer & PMC member
Blog: http://blog.sunlan.me
Twitter: @daniel_sun

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html




Re: About native support for lazy constants

2020-01-12 Thread Remi Forax
Several things to know:
- you can rewrite all access to a field marked @Lazy to use a constant dynamic,
  that part can already be implemented. If you want to keep the compatibility
  with Java 8, it means that you have to have two translations one for Java 11+
  and one for Java 10-.
- if you want the bytecode getstatic to access the field, here you need the VM
  to be changed, it's in the roadmap for the VM but not yet implemented
- you don't care about getstatic because you can simulate it with an indy*
  (which means that even with @CompileStatic you will use indy)
  in that case you can implement it but it means that all codes that use
  a combination of @Lazy + @CompileStatic has to be recompiled.

Rémi

* there is actually no support of ldc constantdynamic in java.lang.invoke.


- Mail original -
> De: "sunlan" 
> À: "dev" 
> Envoyé: Dimanche 12 Janvier 2020 13:34:22
> Objet: About native support for lazy constants

> Hi all,
> 
>  I read an article[1] about the new features of Java 11 just now, and
> find "JEP 309: Dynamic Class-File Constants"[2] can help us implement lazy
> constants elegantly, e.g. `@Lazy static final Object SOME_LAZY_CONST =
> `. The feature is very useful, so I propose to add *native*
> support for lazy constants in some future version of Groovy.
> 
>  Any thoughts?
> 
> Cheers,
> Daniel.Sun
> [1]
> https://javabeginnerstutorial.com/core-java-tutorial/java-11-new-features/
> [2] https://openjdk.java.net/jeps/309
> 
> 
> 
> -
> Apache Groovy committer & PMC member
> Blog: http://blog.sunlan.me
> Twitter: @daniel_sun
> 
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
r


About native support for lazy constants

2020-01-12 Thread Daniel.Sun
Hi all,

  I read an article[1] about the new features of Java 11 just now, and
find "JEP 309: Dynamic Class-File Constants"[2] can help us implement lazy
constants elegantly, e.g. `@Lazy static final Object SOME_LAZY_CONST =
`. The feature is very useful, so I propose to add *native*
support for lazy constants in some future version of Groovy.

  Any thoughts?

Cheers,
Daniel.Sun
[1]
https://javabeginnerstutorial.com/core-java-tutorial/java-11-new-features/
[2] https://openjdk.java.net/jeps/309



-
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html


Re: [VOTE] Release Apache Groovy 3.0.0-rc-3

2020-01-12 Thread Andres Almiray
+1 (binding)

Sent from my primitive tricorder

> On 12 Jan 2020, at 1:12, Paul King  wrote:
> 
> 
> 
> Dear development community,
> 
> I am happy to start the VOTE thread for a Groovy 3.0.0-rc-3 release!
> 
> This release includes 26 bug fixes/improvements as outlined in the changelog:
> https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12318123=12346592
> 
> Tag: 
> https://gitbox.apache.org/repos/asf?p=groovy.git;a=tag;h=refs/tags/GROOVY_3_0_0_RC_3
> Tag commit id: 2b57d13c95da204e8883e2a50cc58658ab10abb2
> 
> The artifacts to be voted on are located as follows (r37572).
> Source release: 
> https://dist.apache.org/repos/dist/dev/groovy/3.0.0-rc-3/sources
> Convenience binaries: 
> https://dist.apache.org/repos/dist/dev/groovy/3.0.0-rc-3/distribution
> 
> Release artifacts are signed with a key from the following file:
> https://dist.apache.org/repos/dist/dev/groovy/KEYS
> 
> Please vote on releasing this package as Apache Groovy 3.0.0-rc-3.
> 
> Reminder on ASF release approval requirements for PMC members:
> http://www.apache.org/legal/release-policy.html#release-approval
> Hints on validating checksums/signatures (but replace md5sum with sha256sum):
> https://www.apache.org/info/verification.html
> 
> The vote is open for the next 72 hours and passes if a majority of at least 
> three +1 PMC votes are cast.
> 
> [ ] +1 Release Apache Groovy 3.0.0-rc-3
> [ ]  0 I don't have a strong opinion about this, but I assume it's ok
> [ ] -1 Do not release Apache Groovy 3.0.0-rc-3 because...
> 
> Here is my vote:
> 
> +1 (binding)
> 


Re: += and -= no longer rejected in assertion statement in Groovy 3

2020-01-12 Thread Daniel.Sun
In Java, `int a = 0; assert a+=1` will fail to compile because expecting
boolean value, but `int a = 0; assert 0 == (a+=1)` is OK, so I think we
forbidden assignments seems not correct...

Cheers,
Daniel.Sun



-
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html