[Issue 4088] opEquals not called on interfaces

2018-02-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4088

Simen Kjaeraas  changed:

   What|Removed |Added

 CC||simen.kja...@gmail.com

--- Comment #19 from Simen Kjaeraas  ---
*** Issue 5459 has been marked as a duplicate of this issue. ***

--


[Issue 4088] opEquals not called on interfaces

2012-02-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


Steven Schveighoffer schvei...@yahoo.com changed:

   What|Removed |Added

 Resolution|INVALID |FIXED


--- Comment #18 from Steven Schveighoffer schvei...@yahoo.com 2012-02-09 
05:36:21 PST ---
Restoring resolution, this was fixed after all.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2012-02-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #11 from Walter Bright bugzi...@digitalmars.com 2012-02-08 
18:42:42 PST ---
This is also the root cause of bug 7451.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2012-02-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


d...@dawgfoto.de changed:

   What|Removed |Added

 CC||d...@dawgfoto.de


--- Comment #12 from d...@dawgfoto.de 2012-02-08 19:10:45 PST ---
It think the proposal in #5459 goes into the right direction.
One point of it is to prefer interface opEquals over a downcast.

Also, if an interface had an opEquals with a different signature, then
Object.opEquals becomes hidden.

interface IA
{
bool opEquals(IA o);
}

class A
{
bool opEquals(IA o) { return false; }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2012-02-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||c...@klickverbot.at


--- Comment #13 from Walter Bright bugzi...@digitalmars.com 2012-02-08 
19:11:04 PST ---
*** Issue 7451 has been marked as a duplicate of this issue. ***

--- Comment #14 from github-bugzi...@puremagic.com 2012-02-08 19:11:04 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9c8b88ca89afef97a5d3b81ba7bd65cac71fd6d0
fix Issue 4088 - opEquals not called on interfaces

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2012-02-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||c...@klickverbot.at


--- Comment #13 from Walter Bright bugzi...@digitalmars.com 2012-02-08 
19:11:04 PST ---
*** Issue 7451 has been marked as a duplicate of this issue. ***

--- Comment #14 from github-bugzi...@puremagic.com 2012-02-08 19:11:04 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9c8b88ca89afef97a5d3b81ba7bd65cac71fd6d0
fix Issue 4088 - opEquals not called on interfaces

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2012-02-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2012-02-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


d...@dawgfoto.de changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


--- Comment #15 from d...@dawgfoto.de 2012-02-08 20:04:35 PST ---
Reopened because now implicit interface comparison is fixed,
but having opEquals in interfaces still doesn't work.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2012-02-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #16 from Steven Schveighoffer schvei...@yahoo.com 2012-02-08 
20:16:23 PST ---
Unless the checked-in fix doesn't allow two interfaces to compare, this bug
should be closed.  It is about the difference between comparing two objects and
comparing two interfaces.  Prior to this fix, you con't compare two interfaces
*period*, even if they defined an identical signature to Object.opEquals.

I feel that it should be possible to specialize opEquals for interfaces and
objects, but this is a separate problem (and actually an enhancement).  IIUC,
the applied fix makes it so Objects and interfaces compare in the same way.

If I find I can compare two interfaces in the same way I can compare two
objects, I'll close this as resolved, and you may open a different bug
regarding adding the enhancement of overriding the default behavior of
object.opEquals.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2012-02-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||INVALID


--- Comment #17 from Walter Bright bugzi...@digitalmars.com 2012-02-08 
22:36:28 PST ---
If there's another issue, please open a new bug report, and please provide an
example of the failing code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-10-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #10 from Kenji Hara k.hara...@gmail.com 2011-10-15 02:55:26 PDT 
---
https://github.com/D-Programming-Language/druntime/pull/72

(In reply to comment #8)
 1. what should happen if this is called with a COM object?

If two interfaces are identity comparable, returns its result. Otherwise,
downcast to Object, and the result is false.
And this rule also appleied to C++ interface (COM interface is C++ interface,
and the downcasting from C++ interface to Object returns always null).

 2. how does an opEquals defined in an interface interact with the
 object.opEquals?

An interface's opEquals is not used directly. Object.opEquals is always used
for the interface comparison when it is possible.

 3. a forced cast, unlike an implicit cast, is a blunt instrument that can do a
 lot more than simply cast an interface to its base class. If the arguments are
 other types, what are the conseqences of this forced cast?

Same as Steven's comment in #9.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #9 from Steven Schveighoffer schvei...@yahoo.com 2011-08-08 
05:47:06 PDT ---
(In reply to comment #8)
 Issues that need to be resolved:
 
 1. what should happen if this is called with a COM object?

Compiler error.

 2. how does an opEquals defined in an interface interact with the
 object.opEquals?

If the notion of COM interfaces is specialized, then standard interfaces do not
need to define opEquals, it's assumed that any standard interface (not C++ or
COM) derives from Object, and implicit dynamic casting to Object to do opEquals
should work.

 3. a forced cast, unlike an implicit cast, is a blunt instrument that can do a
 lot more than simply cast an interface to its base class. If the arguments are
 other types, what are the conseqences of this forced cast?

An implicit cast to Object would be the best remedy.  However, the issue of
dynamic casting and blunt casting being conflated would be a good issue to
solve too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #7 from Walter Bright bugzi...@digitalmars.com 2011-08-05 
16:25:25 PDT ---
I'm not at all sure the patch is the right solution to this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-08-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #8 from Walter Bright bugzi...@digitalmars.com 2011-08-05 
20:34:51 PDT ---
Issues that need to be resolved:

1. what should happen if this is called with a COM object?

2. how does an opEquals defined in an interface interact with the
object.opEquals?

3. a forced cast, unlike an implicit cast, is a blunt instrument that can do a
lot more than simply cast an interface to its base class. If the arguments are
other types, what are the conseqences of this forced cast?

A change of this sort needs to resolve these issues, and have test cases to
verify them.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-06-10 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||ben...@tionex.de


--- Comment #6 from yebblies yebbl...@gmail.com 2011-06-10 08:59:07 PDT ---
*** Issue 2794 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-02-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


Trass3r mrmoc...@gmx.de changed:

   What|Removed |Added

 CC||mrmoc...@gmx.de


--- Comment #3 from Trass3r mrmoc...@gmx.de 2011-02-18 05:54:06 PST ---
Can't dmd just check the type of a given interface and only allow implicit
casts to Object if it is a normal one, i.e. no COM and no C++ interface?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-02-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #4 from Steven Schveighoffer schvei...@yahoo.com 2011-02-18 
08:33:19 PST ---
(In reply to comment #3)
 Can't dmd just check the type of a given interface and only allow implicit
 casts to Object if it is a normal one, i.e. no COM and no C++ interface?

I'm not familiar with the internals of the compiler, but I believe this is
true.  I think it should be statically verifiable that an interface is a COM
interface, and then opEquals can be handled differently.

However, we continue to get silence from Walter on this...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-02-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088


Trass3r mrmoc...@gmx.de changed:

   What|Removed |Added

   Keywords||rejects-valid


--- Comment #5 from Trass3r mrmoc...@gmx.de 2011-02-18 15:51:23 PST ---
I think this should be tackled at a deeper level, probably somewhere around
MATCH TypeClass::implicitConvTo(Type *to) in mtype.c

to allow implicit conversions of interfaces to Object in general.

Then also this works:

void foo(Object o) {}
Interface i;

foo(i);
// or 
Object o = i;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2011-02-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #2 from d...@dawgfoto.de 2011-02-13 16:49:22 PST ---
Created an attachment (id=907)
Proposed fix

It is actually a very surprising bug, that interfaces can't be compared as it
might break structs due to the compiler generated opEquals.
The attached patch does an explicit cast to Object.
This would still not work with C++/COM interfaces.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4088] opEquals not called on interfaces

2010-05-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #1 from Steven Schveighoffer schvei...@yahoo.com 2010-05-19 
15:27:58 PDT ---
Note, this is a problem for dcollections 2.0:

http://www.dsource.org/projects/dcollections/ticket/4

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---