--- Comment #3 from Jonathan M Davis <> 2011-07-18 13:43:18 
PDT ---
Well, that's why I said warning rather than error. But I would consider it bad
practice to use == null anywhere with arrays. I'm automatically go to look at
it and wonder whether the programmer really meant is null (and they probably
did). And since I'd expect most code to import std.array if it's doing much
with arrays at all, I'd fully expect it to have access to empty. And while
arr.length == 0 is not as short as arr == length, it's far less error prone. I
think that the used of arr == null implies a fundamental misunderstanding on
the part of the programmer using it. Now, maybe they do understand that it's
the same as arr.length == 0 or arr.empty, but the odds are so high that they
really meant is null that I do _not_ think that code should be using == null.
If you're talking about "code smells" as Bearophile likes to, arr == null
_definitely_ smells. Sure, it _might_ be that it does what the programmer
intended, but odds are that it doesn't.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to