[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r24557 - trunk/subversion/bindings/javahl/native

From: Branko Čibej <brane_at_xbc.nu>
Date: 2007-04-13 01:25:25 CEST

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

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.