Should we deprecate comma?

Kenji Hara k.hara.pg at gmail.com
Sun Mar 23 19:21:04 PDT 2014


2014-03-24 10:38 GMT+09:00 Daniel Murphy <yebbliesnospam at gmail.com>:

> "Kenji Hara" <k.hara.pg at gmail.com> wrote in message
> news:mailman.27.1395624482.25518.digitalmars-d at puremagic.com...
>
> 2014-03-24 10:09 GMT+09:00 bearophile <bearophileHUGS at lycos.com>:
>
>      if (cond) exp1, exp2;   // in most case, this is not a bug.
>>
>
> It's not a bug, but this does the same thing - so why use the comma
> operator?
>
> if (cond) { exp1; exp2; }
>
> It catches bugs that are otherwise very difficult to spot.
>

At least I can imagine two reasonable cases.

1. If the code is ported from C/C++, breaking it is not reasonable.

2. If the two expressions are strongly related, using comma operator is
reasonable to represent the intensity. I think rather it's an *ability* to
represent code meaning by using code style.

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140324/146aafb7/attachment.html>


More information about the Digitalmars-d mailing list