[Issue 7079] BigInt bool assign
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 8 04:33:40 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7079
--- Comment #2 from bearophile_hugs at eml.cc 2011-12-08 04:33:39 PST ---
(In reply to comment #1)
> I don't think:
>
> int x = true;
>
> should compile. That looks like a bug to me (a relic of 'bit').
The 'bit' type has no relation with this problem.
In languages as Java and Pascal boolean values and integer values are two very
distinct types. In languages like C/C++/D/Python boolean is a kind of subset of
integer type. This means
int x;
bool b;
x = b; // OK, it's a subset
b = x; // error, generally
There are many situations where the implicit true -> 1 conversion is handy.
D accepts the implicit true -> 1 conversion in all cases. Refusing it only in
BigInt assignements breaks the language simmetry. I don't think the implicit
true -> 1 conversion will be removed from D2, so I think it should be present
in BigInts too.
--
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