version: multiple conditions
Joakim via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jun 14 07:26:25 PDT 2015
On Sunday, 14 June 2015 at 11:03:49 UTC, ketmar wrote:
> On Sun, 14 Jun 2015 10:35:30 +0000, Joakim wrote:
>
>> It does require more definitions, but it's worth it. A simple
>> example
>> like yours may seem excusable, but there's no way to limit
>> such logic to
>> just simple instances. Walter is coming from long experience
>> with this,
>> and even with my limited experience with such logic, I'm
>> grateful for
>> it, as dealing with more complex versions of such logic is a
>> royal PITA.
>
> honestly, if i'll want to have a limited language, i'll take
> Go. removing
> a power only 'cause it can be abused is not in a "spirit of D",
> at least
> as i see it. templates can be enormously abused, but noone
> claims that
> they should be removed, as code without templates sometimes
> easier to
> follow, and abusing templates can be a PITA.
Walter explained his thinking behind this decision in five
comments on this PR:
https://github.com/D-Programming-Language/dlang.org/pull/243#issuecomment-12883555
I agree with him. You shouldn't be using such logic at the point
the code is inserted or elided. It can get very confusing as you
layer on logic and is extremely brittle for anything approaching
even a medium-sized codebase. You may be able to get away with
it for a small codebase, but then you really can't complain about
repetition, because there isn't much code in the first place. ;)
Of course, there's always a way out: use static if like Etienne
did in his linked file. But that's not a good practice and it's
good that Walter is to discouraging it.
More information about the Digitalmars-d
mailing list