Yes, the only "native" mechanism I know to do coertion in Groovy (without
applying metaprogramming) is to overwrite the asType method and apply it
explicitly.
For me creating an AST transform it's a very cool idea. Maybe, we could
come up with a library having a configuration file with predefined
Dnia Piątek, 31 Marca 2017 16:02 Marcin Zajączkowski napisał(a)
> Hi,
>
> To simplify initialization of my production Money object in tests I've
> written an extension module to use explicit coercion:
>
> > Money tenDolars = 10.0 as Money //works fine, but could be shorter
>
> It works fi