Disallowing ?:?: syntax

Miles _______ at _______.____
Mon Jan 5 09:23:45 PST 2009


Nick Sabalausky wrote:
> This makes my highly DRY-oriented mind think:
> 
> While ?: is an expression-based counterpart to the statement-based 
> if...else, maybe we could use a similar expression-based counterpart to 
> switch? (I think I've seen such a thing in hardware description languages)

I think I have seen that using a mixture of recursive templates and lazy
evaluation. But sure, that would be a nice addition to support a
relatively common use-case.

Two things I miss are the ?: GNU C extension ( a ?: b  expands to  a ? a
: b , except that a is evaluated only once) or the ?? C# construct
(similar idea, but only tests for null reference).



More information about the Digitalmars-d mailing list