On 2010-11-16 01:10, Daniel Murphy wrote:
I think allowing the second expression in the ternary operator to be omitted
would be a better fit for D, and provide the same function.

ie.
auto x = a ? a : b;
auto x = a ? : b;

Personally I had '|||' in mind, but I'm OK with '?:'. I think it should be one single token and not an extension of the tertiary operator, though:

auto x = condition ? a : b; // tertiary operator
auto x = condition ? : b; // error, did you forget the middle operand?
auto x = a ?: b; // OK

--
Cheers,
Per Å.

Reply via email to