C++ traps that D2 doesn't avoid yet?

bearophile bearophileHUGS at lycos.com
Thu Nov 6 13:07:48 PST 2008


Steven Schveighoffer:
> Even experienced developers fall into some of these traps.  I know I 
> occasionally fell into this trap:
> if(x);
>   x->doSomething();
> But no more with D, because it's not allowed.  Those kinds of things can be 
> easily prevented, and are common mistakes by all programmers.

In Delight it's also quite difficult to fall in that trap:
if x:
    x->doSomething()
Many variants of that syntax are all disallowed:
if x
    x->doSomething()
if x:
x->doSomething()
if x
x->doSomething()
etc.

So instead of making the language more confusing, it actually has the opposite effect.

Bye,
bearophile



More information about the Digitalmars-d mailing list