> Why would the programmer become confused?  In C++ (a mainstream OO
> language), if a Dog constructor was defined that took a string as an
> argument, the string would be auto-converted to a Dog.

Yes, C++ implicitly treats single argument constructors 
as conversion constructors. They convert the data type 
of the argument into the expected class.

What if you don't want your constructor to act like a 
conversion operator? C++ requires you to use the 'explicit'
keyword.

I love the power of C++, but merely tolerate its syntax. 
I'd like to see Perl provide a better conversions syntax.

Perl might be able to deliver conversion operators without
constraining its constructor syntax. Perhaps we could steal
an idea from C#. C# expects you to define conversion
operators instead of implicitly using single-argument
constructors for that purpose. In Perl that might be:

1. Reserve 'CONVERT' for conversion constructors?

2. Add a ': conversion' declarator for functions used
   as conversion operators?

Reply via email to