Parenthesis around if/for/while condition is not necessary
Seb
seb at wilzba.ch
Mon Jul 2 20:28:06 UTC 2018
On Sunday, 1 July 2018 at 12:02:03 UTC, Nick Treleaven wrote:
> On Sunday, 24 June 2018 at 23:40:56 UTC, Timoses wrote:
>> The others may be rewritten to not have a leading "!" as well,
>> e.g.
>>
>>> if (!(t1.ty == Tarray && t2.ty == Tarray && needsDirectEq(t1,
>>> t2))
>>
>> if (t1.ty != Tarray || t2.ty != Tarray || ...)
>
> Yes, but you might make a mistake, and sometimes it makes more
> intuitive sense to read it in a non-minimized form. This type
> of change is also much harder to review. Consider why the
> change got checked into dmd, without it being minimized at the
> time or in a later pull.
>
> C# supports `if !(`.
and it wouldn't be hard for D to support it too:
https://github.com/dlang/dmd/pull/8440
It just requires someone to step up and write the DIP.
More information about the Digitalmars-d
mailing list