groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <>
Subject Re: [VOTE] Inner-project extension methods
Date Thu, 04 Jan 2018 12:44:46 GMT
On 03.01.2018 19:56, Nathan Harvey wrote:
> This idea is unrelated to categories. The behavior would be identical to
> current extension methods, except you can use them within the same project.
> No special importing or scoping required, just as it works currently.

just as it works currently is that a service provider like structure is 
used. As things are already compiled once the dynamic code takes notice 
of extension methods, this means to me, that there is nothing to do here 
for normal Groovy.

In my opinion we are then more talking about a "bugfix" for the static 

> Hopefully that answers most of the questions you have. I don't know about
> how it would work with Java 9.

equally bad :(

> I am personally against an "import extension" strategy because of the
> difficulties it would probably introduce for IDEs. Consider you've added a
> String extension method, but it's not marked with anything in particular,
> because you can just "import extension." If you start typing the method
> name, it has no idea which method could be used as an extension. Basically,
> there has to be some indicator on the declaring method, which makes "import
> extension" useless IMO.

the method would still have to be a static method with the this/self 
parameter being the first one and defining the type. If that is solved 
for normal extension methods and/or categories, then there should be no 
problem for the IDE.

bye Jochen

View raw message