groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Harvey <nathanwhar...@gmail.com>
Subject Re: Extension method upgrades
Date Fri, 15 Dec 2017 05:10:46 GMT
I think your first step - "define a file that contains extension functions" -
is slightly wrong. In Kotlin, you can place extension methods anywhere, they
do not have to be confined to a single file (or worse, like Groovy, in a
totally different dependency). The syntax I discussed is what enables them
to do this.

I'm not sure of the troubles this introduces in a dynamic context, but it
seems your assumptions about the compiler reading in all classes then
parsing extension methods first is likely the correct way to do it. Maybe
someone with more knowledge can chime in. I do think multiple conflicting
extension methods should error in the exact same way that normal methods
error.

I think allowing extensions or "import extensions" would be a step in the
right direction. The main technical hurdle seems to be allowing the methods
to be declared within the same project. From there it is just syntax
differences.



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Mime
View raw message