Hyrum K. Wright wrote:
> Interesting. The standards committee must have included the implicit
> conversion operator capabilities for /some/ reason, though. If the only
> reason *not* to use it is that there's "too much magic" going on, I'm
> not sure that I completely buy that. I'm just concerned that we're
> throwing the baby out with the bathwater in an attempt to make things
> foolproof.
>
Like many interesting features of C++ (and C), implicit conversions can
be indispensable in some cases, but are dangerous most of the time. If
you don't need them, don't use them.
In this case, the you can get the syntactic sugar by adding inline
overloaded functions that accept a const Path& to wrap the API
functions. The effect on the syntax is the same, but you avoid the
dangers of the implicit conversion being triggered when you don't
actually want it, due to an all-to-easy programming error.
To turn your argument around: The standards committee included the
'explicit' keyword so that programmers can create single-argument
constructors that aren't implicit conversions precisely because implicit
conversions are so inconvenient in the general case.
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Apr 13 01:26:07 2007