groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paco Zarate <>
Subject Re: Consider statically typed/compiled as default for Groovy 3.0
Date Mon, 16 Oct 2017 18:35:55 GMT
I really like this topic.
1) Groovy syntax is incredible readable/maintainable. I take Groovy code
from years ago and I am able to make changes easily. Thank you guys for

2) The dynamic portion of Groovy is interesting but it has some limits:
when you are coding you need to recompile to see a change on a single line.
Is it possible to have a the code recompiled on the fly? Is it possible in
Groovy to step back during the debug? And finally, would be a way to be
debugging Groovy code, hit a breakpoint, modify some already executed code
on the fly, step back and rerun it? I guess all this is more tooling
related than language related, but I would appreciate your opinions.

3) Have you seen the Smalltalk;s Pharo environment? they have visual tools
to access and modify the Smalltalk app internals.  For example, see all the
objects and modify then in the fly, include more code, save the state of
the app (image) and reload it later. It is really interesting and I wonder
if Groovy could use its dynamic nature that way.

4) For the static portion of Groovy: Have you think in the Typescript way
of doing things? They are the "javascript++" but they have been doing it
though transpiling to a very readable javascript. The option I see, would
be to have Groovy generating Java code + maps for debugging. The use case
would be: you work in a Java company, use Groovy to develop and then
deliver to your company very readable Java code. I guess this may be doable
with CompileStatic Groovy code and have a chance to apply too to generate
Android Java code.

On Fri, Oct 13, 2017 at 7:14 AM, Cédric Champeau <>

> Wise words, Paul. I would also very much prefer to see progress in the
> Java 9 area rather than this, or even the parser. It's much more relevant
> to the future of Groovy IMHO. Because, as the ticket explains, there's
> already ways to enable this feature (even if a bit cumbersome). It's really
> of that importance, then a pull request, accepted through a VOTE, would
> certainly be the fastest way to get this.
> 2017-10-13 15:11 GMT+02:00 Paul King <>:
>> I think most committers are also keen on making progress in the
>> directions you describe. Not along the lines of watering down Groovy's
>> dynamic capabilities but certainly in terms of making Groovy's static
>> nature as hassle free as possible to use. Having said that, we have limited
>> resources, so we need to prioritise and do a limited numbers of things well
>> rather than half do lots of things. Most of us have our own long list of
>> technical issues that we think need working on (jdk9 support, new parser,
>> bugs we know of in static type checking, many other features we'd like,
>> etc.), so if you aren't seeing a lot of traction for this idea, it is
>> possibly because we see a big list of things that would be needed to be
>> sorted out to do this well and we are weighing up that list with our
>> already long todo lists.
>> Perhaps we wear our technical hats too much and should put on our
>> marketing hats a bit more - who knows. All I can suggest to you is that
>> Apache Groovy follows the Apache do-ocracy culture. If anyone picks off a
>> small piece of the puzzle and advances it forward, it is likely to
>> progress. But it's not guaranteed, so you are doing the right thing by
>> discussing on the mailing lists. If you still don't get traction, start
>> again with a smaller step.
>> Cheers, Paul.
>> On Fri, Oct 13, 2017 at 6:30 AM, MG <> wrote:
>>> blackdrag suggested to move this
>>> discussion from Jira to this list, so I am replying here:
>>> I agree with Endre Stølsvik: I think Groovy should strengthen its
>>> language support for statically compiled use, and I agree it should move
>>> towards making statically using it as hassle free as possible.
>>> I think Endre has already made some good points why this would be a good
>>> idea, so I am just going to add that I am convinced that Groovy would not
>>> be at 3% of the languages used after Java, but at > 30% (basically everyone
>>> that could freely pick a language for commercial projects besides Java
>>> would be using it) if it would fully be the Java++ it in fact is - in my
>>> perception what kept it back was the fact that it "is slow" (true > 10
>>> years back), that it is just "a script language" (never true afaik) - and
>>> that it "is a dynamic language" (no longer true, but...). When I picked
>>> Groovy for the project I work on, I did so despite it was dynamic, not
>>> because of that (the static Groovy compiler that someone in Russia had
>>> built at the time helped in the decision...).
>>> Being able to be dynamic in a language is a powerful feature, but one
>>> that is needed only in special cases. Otherwise Groovy would already rule
>>> the Java world ;-)
>>> Being able to have a very simple configscript that qualifies every class
>>> with @CompileStatic is great (
>>> atest/html/documentation/#_static_compilation_by_default), but it is
>>> not simple/easy enough: I agree there should be a "one click" option to
>>> turn all of Groovy to using static compilation by default.
>>> Some ways to achieve this:
>>> # Make a "static Groovy" download available (might just be based on
>>> "including" the @CompileStatic configscript above)
>>> # Compiler switch
>>> # Choose during installation
>>> # Express through the Groovy source file extension:
>>> ## *.groovy ... use configured default
>>> ## *.groovyd ... dynamic
>>> ## *.groovys ... static
>>> (alternatives: *.groovys, *.sgrv, *.grvs)
>>> The last option has the advantage, that everybody can use it easily
>>> everwhere (Shell, IDE, ...), but the disadvantage that all the Groovy
>>> examples out there use *.groovy, which would again might give the
>>> impression to people that Groovy is "mostly a dynamic language". Maybe a
>>> combination of people picking the default mode (dynamic/static) at
>>> download/install time, with the extension approach would work best.
>>> (That the Groovy compiler will try to compile any file with any
>>> extension is OK. In that case I would suggest the fallback if the extension
>>> is not known is dynamic compilation, for backward compatibility reasons.
>>> Configuring extensions to mean dynamic or static compilation would of
>>> course also be an option).
>>> Or the Groovy compiler could throw if no --static or --dynamic compiler
>>> switch was given ? That would force everyone to make a deliberate
>>> decision... ;-)
>>> Just a quick brainstorming mail, to hopefully get the discussion going,
>>> Markus

View raw message