On Monday, 27 August 2012 at 20:29:29 UTC, bearophile wrote:
I think in code like this:

if (a[] >= 0)
    b[] += c[];

The 'b' and 'c' arrays receive the implicit index of the items of 'a' that aren't negative.

Ok, I can see the use of this, but I find the syntax *very* confusing. Expressions shouldn't be able to mess with code semantics like that.

If you wanted to do something like that, I could live with this syntax:

b[] += (a[] >= 0 ? c[] : 0);

The a[] >= 0 returns a vector of booleans, and then the ternary operator acts element-wise with those booleans as the condition.

Reply via email to