[Issue 2347] opIs is missing

2017-07-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2347

--- Comment #5 from Andrei Alexandrescu  ---
OK thanks

--


[Issue 2347] opIs is missing

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2347

Vladimir Panteleev  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Hardware|x86 |All
 Resolution|--- |WONTFIX
 OS|Linux   |All

--- Comment #4 from Vladimir Panteleev  ---
(In reply to Stewart Gordon from comment #1)
> I think that having opIs is philosophically wrong.  The whole point of is is
> to override any type-defined equality operator by forcing a byte-for-byte
> comparison.  There are probably plenty of template libraries and the like
> that rely on this.

Agreed. Currently `is` provides a guarantee that it compares bits and will
never invoke any other user-defined comparison mechanisms. This applies to
user-defined types (structs, classes) as well as floating-point types (where
x==x may not always be true due to NaNs). An opIs operator would break that
guarantee.

User-defined smart references and slices could instead expose identity
comparison via a ".ptr" property, which could then be compared using `==` or
`is`.

Also, I understand that such language additions would need to be done via a DIP
today.

@Andrei: I'll close this (also because this issue is close to a decade old),
but please reopen if you disagree.

--


[Issue 2347] opIs is missing

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2347

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|unspecified |D2

--