On 4/26/2013 11:04 PM, Steven Schveighoffer wrote:
I think the issue (and I am firmly in the foo(1) => long camp) is that bools are
considered better integers than actual integer types (or even floating point
types for that matter).  I agree that bools can be implicitly cast to and from
integers, as a last resort.

The overload system in D is explicitly not based on "better". (The C++ "better" overloading system is for functions, but not for templates.) The D overload system is based on partial ordering, which is the same as what C++ uses for templates.

I don't know for a fact, but I'm pretty sure the partial ordering scheme that C++ selected for templates, which came along many years later, was picked because people realized it was better (and more mathematically robust and defensible).

One of the problems with a "better" matching system is handling functions with multiple parameters, each with their own "better" match. (The C++ Standard devotes a great deal of complex text to this, it boils down to a bunch of rather arbitrary decisions.) Partial ordering solves this neatly and consistently.

As one who implemented C++'s better matching system, I can confidently state that the partial ordering scheme is FAR better overall.

Reply via email to