Re: Automatic closure coercion and delegate

2016-05-02 Thread Joe Wolf
+1 Would it be sensible/possible to add a Closure.FIRST_ARGUMENT resolve strategy and include it in the default resolution chain? The 'it'-less closure would behave as expected even without pre-assigning the delegate (provided that length() was not defined by the delegate/owner). It'd still

Re: Parrot and the ++ and -- operators

2017-01-24 Thread Joe Wolf
Good to know I'll be able to use these patterns in Groovy 3...I think :) -Joe On Tue, Jan 24, 2017 at 11:00 AM, Daniel Sun wrote: > Hi Joe, > > I've added your sample code as test > cases(https://github.com/danielsun1106/groovy-parser/commit/ >

Re: Parrot and the ++ and -- operators

2017-02-14 Thread Joe Wolf
This isn't a good idea at all, but you can produce the C++ behavior by overriding next() in a mutable fashion, e.g. @groovy.transform.TupleConstructor class Bar { int value Bar next() { ++value this } } Bar b = new Bar(0) ++(++(++b)) assert b.value == 3 But in

Parrot and the ++ and -- operators

2017-01-24 Thread Joe Wolf
I accidentally discovered that Groovy 2, in contrast to Java, allows you to apply the ++ and -- operators to the left and right sides of variables simultaneously. int i = 0 ++i++ assert i == 1 and you can also chain them in a single statement provided you apply parens int i = 0 ((i++)++)++

Groovy JDK Docs for 2.5.0

2018-05-30 Thread Joe Wolf
I noticed the Groovy 2.5.0 documentation reflects the extension methods added to the java.time package and sub-packages ( http://groovy-lang.org/groovy-dev-kit.html#_working_with_date_time_types), but the Groovy JDK docs do not mention them (http://groovy-lang.org/gdk.html ). The necessary files

Re: Java 8 Date/Time API Extensions Methods [GROOVY-8334]

2018-02-19 Thread Joe Wolf
's really wonderful! > I'm really looking forward to seeing that integrated. > > Did you also have a pointer to a doc / page / blog which shows those > methods in action? > (which we could potentially add to our online documentation) > > Guillaume > > On Mon, Feb

Re: Java 8 Date/Time API Extensions Methods [GROOVY-8334]

2018-03-17 Thread Joe Wolf
ubmit a PR and where we can discuss any minor implementation or documentation details. -Joe On Mon, Feb 19, 2018 at 11:26 AM, Guillaume Laforge <glafo...@gmail.com> wrote: > Sounds awesome! > Anyhow, I already like what I see, those methods sound very useful to me! > > On Mon

Re: Java 8 Date/Time API Extensions Methods [GROOVY-8334]

2018-03-19 Thread Joe Wolf
Thanks for the feedback and the pull! Glad there was consensus on the strict upper bound view for upto/downto. Everything was essentially straightforward one liners except for those two methods. Daniel, in regards to being considered as a champion candidate, that's flattering, but being able to

Re: Java 8 Date/Time API Extensions Methods [GROOVY-8334]

2018-03-21 Thread Joe Wolf
t add a fourth amount argument. The > 3-arg downto could be removed. The step method counts up or down depending > on whether from or to is biggest. It throws an "infinite loop" runtime > exception given a zero amount. We could follow that behavior. > > Thoughts?