[Issue 9999] Integer literal 0 and 1 should prefer integer type in overload resolution

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 27 13:23:22 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9999



--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> 2013-04-27 13:23:21 PDT ---
Walter, I can understand your concern. But I think it would not be so big.
Because the possibility of extending basic type set is not so much in the
future.

Keeping language spec simple is necessary, but also reduce special rule for
humans is also important. This is a much rare case that is the mismatch between
simple rule and natural behavior for human. Fixing this issue would be valuable
for many D users.

Logically 'true' and  'false' are not related to any integer values. Although
it is widely known and used, considering boolean type as a kind of specialized
integer type is not general - it is implementation detail. At least it comes
from C language. In old ages, boolean type had not been supported properly in
many programming languages, but today, languages which not supporting it would
not regarded as useful. D is a modern programming language, so more proper
behavior for boolean type is necessary.

As one of its goal, D should aim the successor of C. Therefore, we cannot drop
the implicit conversion between bool and other integer types which inherited
from C.
But this problem behavior is definitely unnatural for many programmers, and
would enforce to study bad know-how for them. Loosing future users for the
compiler simplicity is not good decision. Of course, balance is necessary
there, but I think this is necessary complexity.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list