12 Apr 2004 12:22
Re: [IDEA] auto-type coercion thoughts
On 10 Apr 2004, at 13:38, Jon Tirsen wrote: > Yuri Schimke wrote: > >> the return type of the method will guarantee that. > > > But unless you declare the type it won't be there. > >> Perhaps a combination of both? >> >> GroovyObject has a toType(Class) method, GroovyObjectSupport default >> implementation looks for to<Class> methods like toReader, >> toBufferedReader etc. >> >> This was you could implement toType your self, or just reuse existing >> toReader methods by leaving it out. > > > Yes! I really like this. Clean, elegant and customizable. Agreed. I think implicit conversions are probably bad, but explicit, via the cast operator sound like a good idea. James ------- http://radio.weblogs.com/0112098/
RSS Feed