On 7/12/12 4:49 PM, David Piepgrass wrote:
Yeah, I've been planning to try and get this into D one day. Probably
something like:
(a ?: b) -> (auto __tmp = a, __tmp ? __tmp : b)

gcc used to have that extension and they dropped it...

But GCC can't control the C++ language spec. Naturally there is a
reluctance to add nonstandard features. It's a successful feature in C#,
however, and a lot of people (including me) have also been pestering the
C# crew for "null dot" (for safely calling methods on object references
that might be null.)

I don't see why you would use ?: instead of ??, though.

I think we can add coalesce() with any number of lazy arguments that returns the leftmost argument that is nonzero. It's a useful function but not frequent enough to warrant an operator.

Andrei

Reply via email to