[Issue 7079] BigInt bool assign
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 9 01:34:23 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7079
--- Comment #3 from Don <clugdbug at yahoo.com.au> 2011-12-09 01:34:20 PST ---
(In reply to comment #2)
> (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.
Where did you get the idea that that applies to D? It was certainly true of
'bit', but bool is different.
> 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.
Name one.
There are many uses for 1 -> true. But not the reverse. I can't see why:
int a = b > c; should compile.
> 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,
This is what I disagree with. It's another evil implicit conversion.
--
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