On 12/24/2011 12:31 AM, Jonathan M Davis wrote:
On Friday, December 23, 2011 23:52:00 Timon Gehr wrote:
There is really no problem with that. I have never seen anyone complain
about implicit bool ->  int conversion. Why do you think it is bad? Does
anyone have an example to back up the claim that it is bad?

They're completely different types and mean completely different things. It's
one thing to convert from a narrower integer to a wider one, but bool is _not_
an integer. Would you implicitly convert a string to an int? No. It's not a
number. I don't see any reason to treat bool any differently on that count.
bool isn't a number either. It's true or it's false. The problem is that C
conflated bool with int, and on some level that behavior still exists in D. But
bool and int are two entirely different types and entirely different concepts.

- Jonathan M Davis

Entirely different concepts? oO

bool and int are in no way 'entirely different concepts'. Both are fields. bool is (Z_2, ^, &) , int is (Z_(2^32), +, *). string is conceptually a monoid.

Boolean algebra is the algebra of two values. At least in computer science or digital design, those two values are 0 and 1. If there are implicit conversions in a language at all, implicit bool -> int is a natural thing to do. There is no such argument for string -> int.

Reply via email to