On 2013-12-12 00:23, deadalnix wrote:
On Wednesday, 11 December 2013 at 12:44:52 UTC, Simen Kjærås wrote:
http://wiki.dlang.org/DIP52
Abstract:
Implicit conversion to and from other types are useful, and is to some
extent covered by existing language features. Some cases are currently
not covered, but could be worthy additions to the toolbox.
I've tried to figure out good ways to add some sorely-needed implicit
conversions to the language, but I'm sure there are details that need
to be ironed out. In other words - destroy!
--
Simen
Implicit conversion has proven to be a really bad idea in C++. What make
your solution superior to existing ones ?
C++ has shown that having implicit conversion *by default* is a really
bad idea. For instance, C# also has implicit conversion, but you have
explicitly ask for it. If there's any critique of that anywhere (I
expect there to be), I've been unable to find it.
And of course it'll be possible to abuse implicit conversions, just like
one can abuse function names - this is the old example of 'What does
add(1,2) return? Why, "empty string", of course. After connecting to a
database.'. There's a simple solution to that problem - fire the person
who wrote that code, fix the code, and move on.
Simply put, implicit conversions are not bad, nor good. They are exactly
what you use them for.
--
Simen