Re: Custom implicit type conversion on assignment

2017-03-31 Thread Mario Garcia
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

Re: Custom implicit type conversion on assignment

2017-03-31 Thread Marcin Zajączkowski
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

Custom implicit type conversion on assignment

2017-03-31 Thread Marcin Zajączkowski
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 fine, but it's Groovy so I would like to achieve more :). My idea is to be able t