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 probab

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++)++)++ asser

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/ > 9914682e53fb2fe3d4bb335c8153e61066cea317). >

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 reality

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

2018-02-18 Thread Joe Wolf
I've finally gotten around to adding extension methods to the Groovy JDK for the java.time types. See https://issues.apache.org/jira/browse/GROOVY-8334 for reference. I've generated a copy of the Groovy JDK apidocs with my current changes here: http://bdkosher.github.io/groovy-3.0-alpha/groovy-jdk

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

2018-02-19 Thread Joe Wolf
derful! > 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 19, 2018 at 12:16

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

2018-03-17 Thread Joe Wolf
can submit 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 wrote: > Sounds awesome! > Anyhow, I already like what I see, those methods sound very useful to me! > > On Mon, Feb 19, 2018 at 4:3

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 co

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

2018-03-21 Thread Joe Wolf
-arg upto method to step but 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. &g

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 a

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Joe Wolf
+1 >From a class-centric perspective, if Date is available by default, LocalDate et. al. should also be available. On Sat, May 31, 2025, 7:48 AM James Daugherty wrote: > Hi Paul, > > Is the proposal to do this for 5.x or earlier? > > -James > > On Sat, May 31, 2025 at 6:25 AM Sergio del Amo >