On Saturday, 25 June 2016 at 10:19:47 UTC, Claude wrote:
On Friday, 24 June 2016 at 15:24:48 UTC, Andrei Alexandrescu wrote:
Does anyone else find this annoying? https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei

My 2 cents. I don't find that annoying at all. It's perfectly normal IMHO.

It may introduce an additional indentation level for the second part, but I reckon it is normal to have those 2 instruction blocks at the same level. If we were to introduce a new keyword for "static if else", why not do the same for the run-time "if else" (to be coherent)?

And, if some code have too many indentation levels, than it probably means it should be better modularized, hence I'd suggest to split it in several sub-functions, it will be more readable/maintainable.

I think if we want we could also add `if else` for run-time if too. In D we have wide usage of CT features and particularly `static if`. It becomes annoying and too verbose to write `else static if` when I have multiple branches, so I was thinking for some time to have `elif` keyword. In this case it would be enough to write static just one time at the beginning of `static if`. Compiler could understand that `elif` belongs to this exact `if` or `static if` that was before it.

Reply via email to