What the hell is wrong with D?

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Tue Sep 19 18:51:51 UTC 2017


On Tuesday, 19 September 2017 at 17:40:20 UTC, EntangledQuanta 
wrote:
> I assume someone is going to tell me that the compiler treats 
> it as
>
> writeln((x + (_win[0] == '@')) ? w/2 : 0);
>
> Yeah, that is really logical!

Yeah, I've been bitten by that in languages like C#. I wish D 
didn't follow in C#'s footsteps and chosen a different syntax: 
`()? :`

That way if there aren't any parentheses the compiler could throw 
out an error until you specify what the operating is working 
with. It would make for a little overhead but these complex 
ternary expressions can be confusing.


More information about the Digitalmars-d-learn mailing list