On Wed, 07 Dec 2011 13:19:31 -0500, Nick Sabalausky <a@a.a> wrote:

"Robert Jacques" <sandf...@jhu.edu> wrote in message
news:op.v54q04vd26s...@sandford.myhome.westell.com...
On Wed, 07 Dec 2011 11:49:33 -0500, Alex Rønne Petersen
<xtzgzo...@gmail.com> wrote:

Why is this operator still kept around?

Take your pick:
1) So that legacy B/C/C++/D1/etc code can be trivially ported to D1/D2.

That's a pretty weak counter-argument:

A. I'd think a lot of C/C++ code can't be trivially ported to D anyway.
That statement implies that there is a lot of code that can be trivially ported 
to D.

B. "B", seriously? ;)
Yes, the poster was (in part) asking about where the comma operator came from. 
C did a lot of stupid things to be portable with B and we have all inherited 
that legacy.

C. Being able to link to C/C++ makes it less likely to need to port C/C++
code anyway.
Sure, for code that's in reasonably complete libraries that full fill your use 
cases and are supported by someone else. That's not always the case.

D. Outside of for loops (special-case-able), comma operator is rarely used
in C/C++/D.
Special casing is a big and dangerous hammer. Generally, it introduces extra 
work for the compiler and cognitive load for the programmer. Now, we have used 
special casing to detect common errors to great effect, but these don't add 
cognitive load to the programmer.

E. Even among actual uses of the comma operator, I think it'd be rare (if
even possible) to have a use of it that isn't trivially convertable to
non-comma.
True, but that still implies extra work on the part of the programmer.

2) The comma operator is heavily used in regular old for loops.

That can be special cased.
Ahem. So are you suggesting that (a,b) means a tuple everywhere but in a for 
loop, where it is used to separate two statements?

5) The comma and semicolon are on different keys on US style keyboards.
6) It is trivial to change your keyboard layout (I've hotkeyed Greek for
fast math symbols)

Those are very weak counter-arguments.
I don't disagree, but the poster's original argument was (essentially) that EU 
keyboards put ; and , on the same key, so it was easy to mistype between the 
two. I was just suggesting that maybe the poster might want to fix their 
keyboard before trying to 'fix' the language.

Reply via email to