On Friday, 26 April 2013 at 02:29:07 UTC, Jonathan M Davis wrote:
On Thursday, April 25, 2013 17:35:34 Walter Bright wrote:
> Is bool more specialized than long
Yes, because a bool can be implicitly converted to a long, but
a long cannot
be implicitly converted to a bool.
However, given that bool isn't even an integral type, it seems
very wrong that
it would be a better match than something which _is_ an
integral type. Given
that the compiler already inserts explicit casts to bool in
conditions to
solve the primary case where you want a non-boolean value to
implicitly
convert to bool, it really seems to me that the other
conversions to and from
bool which are currently accepted are far too lax. Another
example of this
would be something like "foo" ~ true. I don't understand why
conversions like
that are allowed by the spec. They're just going to cause bugs.
- Jonathan M Davis
And indeed they do. I did face some very weird bugs caused by
that already.