Np, with the number of annotations in Groovy it's easy to overlook one - see if this one (or e.g. @MapConstructor http://docs.groovy-lang.org/2.5.0/html/gapi/index.html?groovy/transform/MapConstructor.html) does everything that you had in mind...
Cheers,
mg

On 31/05/2020 20:22, o...@ocs.cz wrote:
MG,

On 31. 5. 2020, at 6:37 PM, MG <mg...@arscreat.com <mailto:mg...@arscreat.com>> wrote: Inhowfar would that differ from the existing map based argument support, like @NamedVariant etc (http://docs.groovy-lang.org/2.5.0/html/gapi/groovy/transform/NamedVariant.html) <http://docs.groovy-lang.org/2.5.0/html/gapi/groovy/transform/NamedVariant.html>, respectively what is your intention here ?

Ha, I must be completely blind and dumb, too — I did check, but somehow, I completely overlooked that ASTT!

Thanks, will test the thing, probably it's precisely what I wanted to do.

All the best,
OC

On 31/05/2020 12:45, OCsite wrote:
Hi there,

for both convenience and considerably improved source readability and robustness, I am considering an ASTT which would convert positional arguments to named ones, i.e., something like

@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 ...
}

In farther future with my own typechecking script it might even allow to typecheck named arguments, though that might prove a bit at the difficult side — but technically possible.

Has anybody tried something like that before? If so, bumped into some hidden pitfalls perhaps?

Thanks,
OC




Reply via email to