Re: .with() variant that returns the original object

2016-11-09 Thread Paul King
On Thu, Nov 10, 2016 at 6:45 AM, Jordan Martinez wrote: > What about `object.itselfWith(Closure)`? Then its understood as returning > the object itself but with the changes that follow. Both variants use 'itself' but only one returns 'itself', so I would regard that

Re: .with() variant that returns the original object

2016-11-09 Thread Paul King
Yes, there are no plans to break backwards compatibility, it's very handy to be able to do: def fullName = person.with{ "$firstName $lastName" } We wouldn't want code like that to break. Cheers, Paul. On Thu, Nov 10, 2016 at 7:02 AM, Winnebeck, Jason wrote: >

Re: .with() variant that returns the original object

2016-11-09 Thread Paul King
On Thu, Nov 10, 2016 at 12:02 AM, Cédric Champeau wrote: > I agree with what Jason said. I'm still up for `tap`. We could use > `with(true) { ... }`, but I also dislike "with(returnThis: true) {... }" > because it's not type safe. If we progress GROOVY-7956, we'd have

Re: .with() variant that returns the original object

2016-11-09 Thread Paul King
On Thu, Nov 10, 2016 at 4:44 AM, Jochen Theodorou wrote: > ... And I just noticed Paul made the very same mistake in the original post > already. Ah yes, it should be return it or return "implicitThis" not return this. Cheers, Paul.

Re: .with() variant that returns the original object

2016-11-08 Thread Paul King
Well we certainly could have as per Jochen's suggestion a DGM method roughly like: public static with(def self, boolean returnThis, Closure closure) { ... } and for backwards compatibility returnThis would default to false, i.e. with(closure) and identity(closure) are an alias for with(false,

Re: .with() variant that returns the original object

2016-11-08 Thread Paul King
t was meanting. >> >> Not a big fan of auto, asThis, withThis or within. >> >> My preference clearly goes for tap! >> >> On Tue, Nov 8, 2016 at 3:34 PM, Paul King <pa...@asert.com.au> wrote: >>> >>> Hi everyone, >>> >>> W

.with() variant that returns the original object

2016-11-08 Thread Paul King
Hi everyone, We are hoping to release 2.5 not too far down the track. We are working on a revamped release process that is going to dramatically improve our ability to release early/release often but also comply with some additional Apache requirements that we follow these days. But more on that

Re: Closure does not see field when setting value

2016-11-08 Thread Paul King
println x println binding.variables.x but not closures? Cheers, Paul. On Tue, Nov 8, 2016 at 10:04 PM, Jochen Theodorou <blackd...@gmx.org> wrote: > > > On 08.11.2016 12:19, Paul King wrote: >> >> I think that is probably a bug - but with reads and writes. > &

Re: Closure does not see field when setting value

2016-11-08 Thread Paul King
I think that is probably a bug - but with reads and writes. Change your declaration to "int x = 2" and see what you get? Cheers, Paul. On Tue, Nov 8, 2016 at 8:54 PM, Krzysztof Kowalczyk wrote: > Hi, > Today I was quite confused by behaviour of fields inside of

Congratulations to our newest committer Daniel Sun

2016-11-03 Thread Paul King
Congratulations to Daniel Sun who is now a Groovy committer: https://projects.apache.org/committee.html?groovy http://people.apache.org/phonebook.html?unix=groovy Daniel has been mostly working on the new Antlr 4 parser which will see some exciting steps forward for the Groovy compiler. Cheers,

Fwd: Calling Ant target “collect” from Groovy

2016-09-22 Thread Paul King
Forwarding your question to the users list since it is about using Groovy. Cheers, Paul. -- Forwarded message -- From: ganna_bc Date: Thu, Sep 22, 2016 at 7:51 PM Subject: Calling Ant target “collect” from Groovy To: d...@groovy.incubator.apache.org I am

Re: Looking for testers & feedback: new Groovy binaries for Windows

2016-09-08 Thread Paul King
I think there are numerous problems with the argument passing in the batch files. That was one of the things that the exe files aimed to improve on. I must admit to having reservations about the new approach. Not so much with the concept but more about relying on the current bat files. That said,

Re: Delete Sub Child XML Nodes

2016-08-24 Thread Paul King
def xml = new XmlParser().parseText(employees) xml.'**'.ZipCode.each { it.'..'.remove(it) } XmlUtil.serialize(xml) On Thu, Aug 25, 2016 at 9:06 AM, Paul King <pa...@asert.com.au> wrote: > I forwarded your email to the users list since it isn't about > development of the language cod

Fwd: Delete Sub Child XML Nodes

2016-08-24 Thread Paul King
I forwarded your email to the users list since it isn't about development of the language codebase itself but rather about using Groovy. Cheers, Paul. -- Forwarded message -- From: GroovyBeginner Date: Thu, Aug 25, 2016 at 12:51 AM Subject: Delete Sub

Re: Reporting groovy line number in log4j2

2016-08-22 Thread Paul King
We set the line number to -1 for generated code which doesn't have a corresponding real line in the source code. So, you might be seeing exactly what we expect or it's possible we have missed some case. Can you elaborate further on how you are using the logging? Cheers, Paul. On Tue, Aug 23,

Re: Issue with XML Serialization

2016-08-18 Thread Paul King
ent Groovy versions or are compiling with one version and running with another. Can you add the following line to your script and see what output you get? println getClass().classLoader.rootLoader.URLs Cheers, Paul. . On Thu, Aug 18, 2016 at 8:57 PM, Paul King <pa...@asert.

Fwd: Issue with XML Serialization

2016-08-18 Thread Paul King
-- Forwarded message -- From: GroovyBeginner Date: Thu, Aug 18, 2016 at 8:17 PM Subject: Issue with XML Serialization To: d...@groovy.incubator.apache.org Am facing the issue when serialising the node object. Here is my code but getting an error

Re: [ANN] Release 0.5.0 of spock-genesis

2016-07-18 Thread Paul King
Looks nice! Great work! On Tue, Jul 19, 2016 at 11:29 AM, Dylan Bijnagte wrote: > I just pushed the latest release of spock-genesis > Mostly lazy data generators for property based testing using the Spock test > framework > > New it this release: > * Limit the number of

Re: looks like a missing exception harness in a typechecker somewhere?

2016-07-11 Thread Paul King
I assume (given you say heavily transformed) that you don't have a simple way to reproduce the error? On Tue, Jul 12, 2016 at 7:26 AM, OC wrote: > Hi there, > > with a pretty complex and heavily AST-transformed code, which, nevertheless, > *without typechecking builds and runs all

GenericsVisitor change for Groovy 2.5.0

2016-06-24 Thread Paul King
Hi everyone, I moved the GenericsVisitor earlier in the compilation process. This means that errors involving class usage but supplying an incorrect number of type parameters, e.g. List or HashMap or invalid Diamond operator usage will now be flagged earlier. This is nice

Re: ShortTypeHandling castToString

2016-06-18 Thread Paul King
I updated PR #345 as per your comments (I believe). Let me know if it looks okay. I did require changing one swing test that was relying on the old toString behavior. It would be nice if Andres could comment if such a change could impact Griffon. On Sat, Jun 18, 2016 at 6:04 PM, Jochen Theodorou

Re: ShortTypeHandling castToString

2016-06-14 Thread Paul King
Yes, it's clearly a bug as can be seen by running an example such as below: String foo() { Integer } foo() // ClassCastException Whereas 'Integer as String' works fine. I have a fix for this in PR#345 as part of GROOVY-7853, see: https://github.com/apache/groovy/pull/345 Just waiting for to

Re: search for particular text in a multi-line string

2016-03-16 Thread Paul King
Can you give an example of what isn't working as expected? contains() should be good enough if you have the appropriate line endings in your expected text. Otherwise regex searching might be the way to go. Cheers, Paul. On Wed, Mar 16, 2016 at 2:28 PM, Deng, Lea wrote: >

Re: XmlSlurper, attributes and namespaces

2016-03-06 Thread Paul King
Yes, I think it is a bug. I thought we had a workaround using star, i.e. node.@'*:attributeName', much like node.'*:tagName' but the attribute version with star doesn't work either. On Sat, Mar 5, 2016 at 7:43 PM, Pascal Schumacher wrote: > Hi Jason, > > I do not know.

Re: Example of CliBuilder with "optionalArg: true"?

2016-02-08 Thread Paul King
I think we had some improved handling for optional args in some spikes we did for newer versions of the CLI processing stuff. But none of that has been taken forward yet. In the interim, you can peek at return types as per your examples above or sneak down into the underlying implementation -

<    1   2   3   4   5