On Friday, 26 April 2013 at 21:37:14 UTC, Walter Bright wrote:
On 4/26/2013 1:59 PM, Andrej Mitrovic wrote:
On 4/26/13, Andrej Mitrovic <andrej.mitrov...@gmail.com> wrote:
An even better example:
import std.stdio;
void foo(bool x) { writeln("1"); }
void foo(long x) { writeln("2"); }
void main()
{
foo(1); // "1"
foo(false ? 2 : 1); // "2"
}
Kill it with fire.
How about this one:
import std.stdio;
void foo(short x) { writeln("1"); }
void foo(long x) { writeln("2"); }
void main()
{
foo(30000); // "1"
foo(false ? 40000 : 30000); // "2"
}
We all know that short and long are integer numerics, however
most of us do not think of bool as being a 1 bit integer type. We
expect values of 'true' and 'false' because D has explicit 'true'
and 'false' values, which presumably are there because 1 and 0
which are not the same thing as 'true' and 'false', otherwise
there would be no need for 'true' and 'false'.
--rt