On Sunday, 29 July 2018 at 10:46:12 UTC, Jonathan M Davis wrote:
Well, most folks would just make those separate statements, in
which case, there would be no commas at all. Some folks do put
multiple variable declarations on a single line, but if you do
that, a trailing comma looks terrible. I doubt that using a
single statement to declare multiple variables but putting it
on multiple lines was even a use case that was really
considered. Also, a quick test with a C++ compiler shows that
it's not legal there, so the rules we have with regard to this
probably just came from C++. AFAIK, the only significant change
that D has from C/C++ with regards to declaring multiple
variables in a single statement is that the * is considered
part of the type and thus
int* a, b, c;
declares three variables of type int* in D, whereas in C/C++,
it would declare a single variable of type int* and two of type
int.
- Jonathan M Davis
Thanks a lot for your explantion, Jonathan.
I understand the idea is to minimize the differences between
C/C++ and D (FIXME.) Anyway the missing feature suprised me; I
thought variable declaration is simply a (compile time) list, and
as an array, leading comma was acceptable :)