On 2011-03-17 21:35, Nick Sabalausky wrote:
"bearophile"<bearophileh...@lycos.com>  wrote in message
news:iltdqr$1rd7$1...@digitalmars.com...

D disallows bug-prone C syntax like this (C style guides strongly suggest
to declare only each variable in a distinct statement and line of code):

int a = 1, *b = null;

D accepts code like:

auto a = 1, b = null;

This seems against the D rule of not allowing different types to be
initialized in the same statement. In my opinion on this design detail D
is worse than C++0x. As an example, if you write a line of code like this,
meaning it to initialize six double variables, you have a bug:

auto x1=1., x2=2., x3=3., x4=4., x5=5, x6=6.;


I'm not sure how I feel about D's auto creating multiple types in one
statement. But at the very least, I think your code above is yet another
good example of why "1." and ".1" float-literal syntax needs to die, die,
die. It does what? Saves one character just so it can be less readable and
cause syntax problems for new potential features? Bah.

Yes, it must die. It also conflicts with uniform function call syntax.


There are only few (one?) other thing(s) that I think C++0x gets better
than D, like a more strict enum, I don't understand why D doesn't follows
C++0x design on this other detail:
http://d.puremagic.com/issues/show_bug.cgi?id=3999


I agree that would be nice. Weak typing like that is one of the reasons I
abandoned C/C++, but D still holds on to it in this particular case.





--
/Jacob Carlborg

Reply via email to