DMD 0.148 release

Walter Bright newshound at digitalmars.com
Tue Feb 28 02:32:23 PST 2006


"Ivan Senji" <ivan.senji_REMOVE_ at _THIS__gmail.com> wrote in message 
news:du002m$2pnp$1 at digitaldaemon.com...
> The code could have been while(5). Do you really think 5 is true?

The while expression must be convertible to a boolean, it needn't be a 
boolean. I'm perfectly comfortable with the !=0 nature of the test, and not 
just because I've been doing it for 25 years. It was comfortable right out 
of the gate (and I came to C from Pascal, and never wrote another line of 
Pascal after my first encounter with C).

> The problem in all these bool wars so far is I never saw an argument that 
> would be against true booleans (while(BooleanExpression) and all that...).
> The arguments like:
> while(true) is much much bigger than while(1) or
> while(a)    is much smaller and more understandable than while(a>0)
> //hm while(a) is actually while(a!=0) but did I really mean a>0?)
> and like that don't really count.
>
> Adding true booleans makes no code break, only adds compiler errors that 
> make  a coder think more about what he is doing and require awfull changes 
> from if(b) to if(b!=0) and stop him from doing things like adding two 
> bools or adding an int to a bool.

Like I said, I never looked back with nostalgia upon Pascal after using C 
<g>. I know many people think the wordier versions are more readable. I 
don't. I'm also very reluctant to abandon things that may have contributed 
to C being wildly popular and burying Pascal in an unmarked grave out in the 
desert.

> I still wonder why do you think that many modern and much used languages 
> implement real boolean types and are very proud of that? Does the 
> behaviour of D really fix C/C++ bool isues? Will those seeking a real bool 
> people not say <g> and write alias/typedef int boolean, or something else?
>
> I think those languages have bools because they realize bool is *not* an 
> int but a mathematical concept.

Bool's particular behavior just doesn't have the leverage to make much of 
any difference in real programs. On_scope is far more interesting, because 
for a certain class of programming problems it can have a dramatic effect on 
improving them. 





More information about the Digitalmars-d-announce mailing list