On 08/21/2015 01:34 PM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schue...@gmx.net>" wrote:
On Thursday, 20 August 2015 at 19:41:44 UTC, Jonathan M Davis wrote:
On Thursday, 20 August 2015 at 17:50:11 UTC, Steven Schveighoffer wrote:
if(arr != null)

Definitely don't do that. IMHO, "== null and "!= null" should be
illegal. If you really want to check for null, then you need to use
"is null" or "!is null", whereas if you want to check that an array is
empty, check its length or call empty. By using "== null" or "!=
null", you tend to give the false impression that you're checking
whether the object or array is null - which is not what you're
actually doing.

I disagree. `is null` is the one that should be illegal. `is` is
supposed to do a bitwise comparison,

If 'is null' is disallowed, what's the point of allowing '== null'?

but `null` is usually just a
pointer/reference,  while a slice consists of both a reference and a
length.

There's a 'null slice'. Both pointer and length are null. It's what the implicit conversion from 'typeof(null)' yields.

Which of those are compared?

Both. You explained it above.

Reply via email to