Killing the comma operator

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Wed May 11 02:16:16 PDT 2016


On Wednesday, 11 May 2016 at 09:03:29 UTC, Kagamin wrote:
> On Tuesday, 10 May 2016 at 12:49:28 UTC, Steven Schveighoffer 
> wrote:
>> Note, there was some pretty good examples of (ab)use of the 
>> comma operator in one of those: 
>> https://github.com/dlang/dmd/pull/3399#issuecomment-38401339
>
> If we had control flow statements as expressions one could 
> rewrite
> return a(), b;
> as
> a(), return b;
>
> and thus wouldn't need the C comma expression semantics.

I haven't found any use for control flow statements as 
expressions in D (even though I have programmed in Ruby) so far, 
because the ternary operator covers all my needs.

In this case the intent would be much more clear if you wrote:
a(); return b;


More information about the Digitalmars-d mailing list