--- Comment #9 from Jonathan M Davis <> 2011-07-19 11:21:49 
PDT ---
Except that null and empty are _not_ the same for arrays. True, checking for
null is not as necessary in D, but you _can_ write code which relies on whether
arrays are null or not. And the most likely thing that someone is going to do
if they're writing code like that is to use == null, unless they were paying a
lot of attention when reading the online docs or TDPL and remembered is and how
it differs from ==. If == null and is null were identical, it wouldn't be an
issue, but they're not. It can matter whether a function returns null or "" (or
[]). It can matter whether you use == or is. And I wouldn't expect many people
new to D to correctly use is with null. Rather, if they're checking for null,
they'll use == null. And since there is _zero_ need for == null given the
alternatives and given how it's likely that a newbie would use == where they
should use is, I see no reason that good D code should be using == null (at
best, it's a bit prettier than length == 0, and given that empty matters with
containers, empty should be encouraged over length == 0 anyway). So, given that
it's going to cause problems (and bugs) for newbies, and anyone who knows what
they're doing doesn't need it, I really think that there should be a warning
for using == null.

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

Reply via email to