On Sat, Sep 30, 2006 at 11:48:04AM -0700, Joshua Choi wrote:
> How does automatic coercion work? 
[ deletia ]
> 1. C<sum()> automatically coerces its C<Str> arguments into C<Num>
> parameters because C<Str.does: Num>.
> 2. C<say()> then automatically coerces its C<Num> arguments into
> C<Str> parameters because C<Num.does: Str>.
> 
> ...Or am I completely off the mark?)

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.

I'm of the opinion that if you need a routine to handle multiple
"types" then you should define it such that it is sufficiently general
enough to do so without the benefit of added behind the scenes magic.

-Scott
-- 
Jonathan Scott Duff <[EMAIL PROTECTED]>

Reply via email to