Jonathan Scott Duff wrote:
I hope you're way off the mark. Automatic coercion was one of the annoyances I remember from C++. Debugging becomes more difficult when you have to not only chase down things that are a Foo, but anything you've compiled that might know how to turn itself into a Foo.
OTOH, there is a time and place for so-called "automatic" coercion, such as the way that perl freely converts between Str and Num. Indeed, ISTR something about standardized stringifying and numifying method names that let _any_ object turn into a string or number (or boolean, IIRC) when placed in the appropriate context. And I can see some benefit to extending this ability to other types, as long as it's used sparingly. In particular, I'm thinking about complex numbers - it would be nice to see perl convert between the rectilinear and polar representations of complex numbers in the same way that it converts between Num and Str. -- Jonathan "Dataweaver" Lang