Just a friendly reminder about using arrays in boolean conditions
Nick Treleaven
nick at geany.org
Sun Nov 17 16:47:39 UTC 2024
On Sunday, 17 November 2024 at 08:57:35 UTC, Jonathan M Davis
wrote:
> Personally, I'd love to see using arrays in boolean conditions
> simply be deprecated and then made an error (and maybe changed
> to check for empty at some point in the future if we want to),
> since it's often used incorrectly, and even when it is used
> correctly, it's pretty much always a good idea to do an
> explicit check instead of an implicit one so that it's clear to
> anyone else reading the code what you meant to check for.
It was deprecated and then un-deprecated - see
https://issues.dlang.org/show_bug.cgi?id=4733#c38 for why it was
problematic, possible solutions and also a link to a 2015
discussion.
More information about the Digitalmars-d
mailing list