jastrachan | 18 Nov 13:02 2004
Picon

Re: Feedack on Groovy

On 18 Nov 2004, at 09:25, Dierk Koenig wrote:
> Hi,
>
> just a thought on this:
>
> Ruby does something equivalent when duck-typing.
> E.g. any object that responds to the to_str method
> can be treated as being of Type "String".
> Following the same approach, an object that responds to
> the as_List() method could be treated as being of
> Type java.util.List.
> This would go around the need for Casting and would address
> the question on how to implement the conversion.
>
> Does this make sense for Groovy ?

My worry would be that it makes things more surprising; users should 
typically know when they are coercing things into new types. So my gut 
feel is that coercions should be explicit

James
-------
http://radio.weblogs.com/0112098/


Gmane