On Tue, 16 Nov 2010 09:44:06 +0100
Per Ångström <d-n...@autark.se> wrote:

> 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
 
Yes, then it becomes a binary operator :-) Read "a if defined, else b".


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com

Reply via email to