1. I don't seem to have gotten my own reply from the mailing list (also
not in Junk/SPAM) - strange...
2. Yes, treating null as nil would alas prohibit any usage of null as a
parameter value. That is a long standing problem in many
languages... - I wish there were support for more NULL-like
constants (de facto there is room for at least 4, using memory
adress values 1 to 3 in addition to 0 = NULL), such as NIL or EMPTY,
to be able to distinguish these cases.
3. I agree with the issue, it would be great if further improved named
parameter support would be high on the agenda :-)
Cheers,
mg
On 01/06/2020 12:55, Mikko Värri wrote:
On 1. Jun 2020, at 2.46, MG <mg...@arscreat.com> wrote:
@MapConstructor
On 31/05/2020 20:22, o...@ocs.cz wrote:
On 31. 5. 2020, at 6:37 PM, MG <mg...@arscreat.com> wrote:
@NamedVariant
Thanks, will test the thing, probably it's precisely what I wanted to do.
On 31/05/2020 12:45, OCsite wrote:
@Named foo(bar,int bax=666,List baz) {
... whatever ...
}
turned to something like
foo(Map __map=null) {
def bar=__map?.bar
int bax=__map?.bax==null?666:__map?.bax
List baz=__map?.baz
... whatever ...
}
One thing it doesn't cover, afaik, is default values for the args. But I don't think a
simple null check will do: you can't pass "bar: null" to the method, then.
There's at least one issue open for this:
https://issues.apache.org/jira/browse/GROOVY-9532
-mikko