The Comma Operator's Deprecation Can't Come Soon Enough

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 15 09:51:22 PDT 2014


On Tuesday, 15 July 2014 at 16:45:02 UTC, Jane Doe wrote:
> On Tuesday, 15 July 2014 at 16:16:19 UTC, Andrej Mitrovic via 
> Digitalmars-d wrote:
>> On 7/15/14, Frustrated via Digitalmars-d 
>> <digitalmars-d at puremagic.com> wrote:
>>> On Tuesday, 15 July 2014 at 08:01:40 UTC, Meta wrote:
>>> The 2nd "argument" to typeof makes no sense. It shouldn't be 
>>> on
>>> that line at all. Total fail by the programmer.
>>
>> Well yeah, real world programmers make mistakes.
>
> So, you wanna nerf everything that could produce the wrong 
> behavior? Should be reduce the speed limit to 5mph because cars 
> can kill people?
>
> There is nothing in this example that shows the comma operator 
> is evil. Any programming language as a plethora of similar 
> issues. Should we get rid of || && etc because one might forget 
> to double it?
>
> e.g., if (x | y) when one meant if (x || y)?
>
> It's not the languages fault if you can't pay attention to what 
> you are doing!
>
> The code looks like he copy and pasted the 2nd alias line and 
> forgot to remove the depth part. Again, this speaks nothing 
> about the comma operator but about the programmer.

The reason for getting rid of it is because it's borderline 
useless. It causes more accidental bugs than it enables 
deliberate uses.


More information about the Digitalmars-d mailing list