Re: Negative relational operators for Groovy 3

2016-11-23 Thread Daniel Sun
Hi Guillaume, All features added in the new parser have been synch to parrot branch. I am looking for a better way to report missing the RIGHT parenthesis with less performance reduction ;) Cheers, Daniel.Sun 在 "Guillaume Laforge [via Groovy]" ,2016年11月24日 上午6:14写道: Ooops, a mistake

Re: Negative relational operators for Groovy 3

2016-11-23 Thread Guillaume Laforge
Ooops, a mistake of mine with a missing parens in some code before that. We might have to pay attention to error reporting, and see how good it is to help fix developer's mistakes. On Wed, Nov 23, 2016 at 10:47 PM, Guillaume Laforge wrote: > Is the "parrot" branch covering !in already? > > I fet

Re: Negative relational operators for Groovy 3

2016-11-23 Thread Marc Hadfield
-1 from me on all cases. On Wed, Nov 23, 2016 at 4:47 PM, Guillaume Laforge wrote: > Is the "parrot" branch covering !in already? > > I fetched it today, but got issues with !in > > if (1 !in [0, 1, 2]) {} > > Nov 23, 2016 10:45:29 PM org.apache.groovy.parser.antlr4.AstBuilder > buildAST > SEV

Re: Negative relational operators for Groovy 3

2016-11-23 Thread Guillaume Laforge
Is the "parrot" branch covering !in already? I fetched it today, but got issues with !in if (1 !in [0, 1, 2]) {} Nov 23, 2016 10:45:29 PM org.apache.groovy.parser.antlr4.AstBuilder buildAST SEVERE: Failed to build AST org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed

Re: Double posts

2016-11-23 Thread Pascal Schumacher
There were a lot of double post recently, because the following header was used: To: dev@groovy.apache.org Cc: Groovy_Developers I guess it was caused by somebody sending mails to d...@groovy.incubator.apache.org, which the list forwards with "Reply-To: dev@groovy.apache.org". Then people/

Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Jim Jagielski
+1 > On Nov 23, 2016, at 10:20 AM, Graeme Rocher wrote: > > +1 for ?= >

Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Cédric Champeau
Same here, +1 to ?= This wasn't explicitly stated, but I want to make it clear, regarding the semantics of this operator. I guess it implies "Groovy truth", not "null check" (and we could apply the same kind of optimizations as we have for ?: in static compilation). 2016-11-23 16:20 GMT+01:00 Gra

Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Graeme Rocher
+1 for ?= Cheers On Wed, Nov 23, 2016 at 12:49 PM, Daniel Sun wrote: > Hi Jochen, > >> Maybe we should start a vote of ?= or not... maybe on the user list... >> then we see what people think. Daniel might have been a bit too fast here > I'd like to start the vote of ?=;) > > Just ask

Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Daniel Sun
Hi Jochen, > Maybe we should start a vote of ?= or not... maybe on the user list... > then we see what people think. Daniel might have been a bit too fast here I'd like to start the vote of ?=;) Just ask whether like it or not? Or like Andres's vote, ask which operator do you like:

Re: Negative relational operators for Groovy 3

2016-11-23 Thread Graeme Rocher
-1 from me too, very confusing. +1 for only !in and !instanceof Cheers On Tue, Nov 22, 2016 at 6:46 PM, Jim Jagielski wrote: > Agreed. > >> On Nov 22, 2016, at 6:44 AM, Guillaume Laforge wrote: >> >> I must confess I'm also a bit worried with those operators too. >> For !in and !instanceof, I r

Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Jochen Theodorou
On 23.11.2016 09:34, Marcin Erdmann wrote: [...] I will chip in as the person who proposed that new operator on Twitter to Daniel (thanks Daniel and Guillaume for raising it for discussion here). This idea came up when I needed to add a default key in a map pre-populated with another map:

Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Andres Almiray
FWIW [image: Inline image 1] *aalmiray* If a shorthand notation for Groovy’s Elvis (?:) + assignment were to be added, which one would you pick? 22/11/16 15:44 49 votes so far. 48% in favor of ?= 10% in favor of ||= 20% in favor of ?:= 22%

Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Marcin Erdmann
Jochen Theodorou wrote > So for me a new operator makes more sense. But frankly... > >> def foo(x) { >> return x ?: "empty" >> } > > or even > >> def foo(x) { >> x = x ?: "empty" >> return x >> } > > vs. > >> def foo(x) { >> x ?= "empty" >> return x >> } > > Is that really worth it?

Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Mauro Molinari
In my humble personal experience, I confirm I would have find it useful when properties are involved, i.e.: foo.property ?= 'defaultValue' instead of foo.property = foo.property?: 'defaultValue' or the lengthy: def a = foo.property foo.property = a?: 'defaultValue' Not to say in case of nested

Re: Double posts

2016-11-23 Thread Guillaume Laforge
Not sure how things work there regarding those two mailing-lists, but at least, whenever someone sees incubator in TO / CC, let's be sure to drop it off the list. Now... I thought the new list was just a renaming of the old incubator list, so I don't have much clue as to what's going on. On Wed, N

Double posts

2016-11-23 Thread Mauro Molinari
Hi all, sorry for this OT, but as someone else already mentioned, I'm receiving double posts from some of you (not from all, indeed). Someone suggested to unsubscribe from the incubator mailing list, but I just tried to send an e-mail to: dev-unsubscr...@groovy.incubator.apache.org and a rece

Re: Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Guillaume Laforge
Yeah, a nice example with with{}! On Wed, Nov 23, 2016 at 9:15 AM, Cédric Champeau wrote: > I would say +1 to ?= . There are a few cases where I would have used it. > Typically, configuring some defaults after the fact. I'm not saying this is > a good pattern in general, but it can come handy: >

Re: Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Cédric Champeau
I would say +1 to ?= . There are a few cases where I would have used it. Typically, configuring some defaults after the fact. I'm not saying this is a good pattern in general, but it can come handy: void finalize(Config config) { config.with { foo ?= 'foo' bar ?= 'bar' baz ?=

Re: Re: [PROPOSAL]new operator ?=

2016-11-23 Thread Guillaume Laforge
At least between ||= and ?=, the latter, ?=, definitely make most sense for Groovy. Whether it's safe navigation with ?. or Elvis with ?:, we're still in the same realm of nullability and Groovy Truth. On Wed, Nov 23, 2016 at 12:57 AM, Daniel Sun wrote: > Hi Jochen, > > ?= is similar with *=