[Issue 15793] Change !is error to warning

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P1  |P4

--


[Issue 15793] Change !is error to warning

2016-03-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

--- Comment #8 from Sobirari Muhomori  ---
A little comparison: in java and C# Object.Equals is provided, but not called
implicitly. It's provided, but is opt-in and explicit, it's all somewhat rooted
in java, C# and D just copied it. C# uses C++-style operator overloads, it's up
to them to call Object.Equals or not. Also C# requires x.Equals(null) to always
return false.

(In reply to Steven Schveighoffer from comment #6)
> lowering != null to !is null is the right answer.
That would be awesome.

--


[Issue 15793] Change !is error to warning

2016-03-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

Sobirari Muhomori  changed:

   What|Removed |Added

   Keywords||spec
URL||https://dlang.org/spec/expr
   ||ession.html

--


[Issue 15793] Change !is error to warning

2016-03-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

--- Comment #7 from Jonathan M Davis  ---
> The problem is not best practices, but usability.

As I said, while it's best practice to use is and !is with null, it is a bit
much to treat it as an error to use == or !=. So, I'm not opposed to it being
changed. I'm just pointing out that what it's telling you to do is what you
really should be doing anyway. It's just being too forceful about it.

> lowering != null to !is null is the right answer.

That would be a good approach.

--


[Issue 15793] Change !is error to warning

2016-03-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

--- Comment #6 from Steven Schveighoffer  ---
lowering != null to !is null is the right answer. I would be surprised if
inlining doesn't automatically do this. But of course, the compiler rejects it,
so no way to test it.

--


[Issue 15793] Change !is error to warning

2016-03-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

--- Comment #5 from Sobirari Muhomori  ---
The problem is not best practices, but usability.

--


[Issue 15793] Change !is error to warning

2016-03-14 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

--- Comment #4 from Jonathan M Davis  ---
At this point, comparing null objects will work just fine, since the free
function opEquals that calls the member function opEquals for classes checks
for null first, but if you use is, you skip the call to opEquals entirely. So,
the error is arguably forcing you to follow best practices, but if the error
weren't there, the code would work just fine. It would just be slightly less
efficient.

--


[Issue 15793] Change !is error to warning

2016-03-14 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

--- Comment #3 from Sobirari Muhomori  ---
In reality I'm comparing COM interfaces. I removed the check, it was defensive
anyway. That's my concern actually: such checks should be a no-brainer or it
will cause very nasty consequences in the long run, so yeah, it's disturbing.

--


[Issue 15793] Change !is error to warning

2016-03-14 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

Jonathan M Davis  changed:

   What|Removed |Added

 CC||issues.dl...@jmdavisprog.co
   ||m

--- Comment #2 from Jonathan M Davis  ---
It's still more efficient to use is null or !is null, and it's what code really
should be doing, but making it an error to use == null or != null is arguably a
bit much.

--


[Issue 15793] Change !is error to warning

2016-03-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com
   Severity|regression  |enhancement

--- Comment #1 from Steven Schveighoffer  ---
Some backstory:

Originally, if a was actually null, this would cause a segfault (it would try
to call a.opEquals(null), which was a virtual call, etc.). This is why the
error was added -- any usage of != null for classes/interfaces was never what
you really wanted.

But with the current way object comparisons are done, != null would do the
correct thing. I think actually, we can remove the error completely.

--


[Issue 15793] Change !is error to warning

2016-03-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15793

Sobirari Muhomori  changed:

   What|Removed |Added

   Severity|major   |regression

--