Disallowing ?:?: syntax

Stewart Gordon smjg_1998 at yahoo.com
Mon Jan 5 04:00:26 PST 2009


bearophile wrote:
<snip>
> My little proposal for D is to turn the following into a syntax 
> error, to avoid possile programmer mistakes (so the programmer must 
> put parentheses here to make it compile):
> 
> x ? y : a ? b : c
<snip>

Here, right-associativity is intuitive - it's analogous to 
if-then-elseif.  So it should probably still be allowed.

IMO if there's anywhere where parentheses should be required, it's on 
the confusing combinations of bitwise and relational operators.

Stewart.



More information about the Digitalmars-d mailing list