static if enhancement
QAston via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jun 26 14:14:16 PDT 2016
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
Please no. I'd argue that this brings more confusion than
readibility. Imagine reading more complicated code with this. You
have to do control flow analysis on if-block to determine whether
code outside of if block is included in compilation. Doesn't
sound good for reading, does it.
Imagine explaining static if block rules to new people. "Well
static if works this way, except it doesn't create scope. Also,
we have this another special rule, where we create else blocks
implicitly if all paths in static-if block return early. This
saves you writing six characters and an intendation level."
Also - metaprogramming. You don't know the control flow of
whatever you may be printing in a mixin, or having as a parameter
in a template. Making such code even more difficult to analyze.
More information about the Digitalmars-d
mailing list