groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: Improving named-argument support
Date Thu, 18 Jan 2018 02:16:29 GMT
Response below.

On Wed, Jan 17, 2018 at 7:44 AM, Nathan Harvey <nathanwharvey@gmail.com>
wrote:

> Paul, I am very much in favor of this idea, but I do not like the
> execution.
> The need for those annotations makes it quite verbose and it seems a bit
> too
> complex. I agree with Daniil that having the "required" flag is also
> unnecessary. @NamedParam seems like it should be assumed. I understand the
> use case of @NamedDelegate but again, it adds complexity. Ideally you would
> only need one annotation to the method for a sensible default case.
>

 I imagine a very common use case would be to just have the single
@NamedVariant
annotation on the method/constructor and nothing else. The other
annotations are
just used to cover the more complex use cases that have been spoken about in
various discussions. If you don't need them, don't use them. There are many
examples
even in the Groovy codebase where auto `required` wouldn't be appropriate,
e.g. the
Sql.newIstance case. There are examples of using that with various
combinations:
(url, properties), (url, driverClassName), (url, username, password,
driver), etc.
There are other examples where required would make sense.

Mime
View raw message