Re: User-defined "opIs"

2014-09-29 Thread Marco Leise via Digitalmars-d
Am Sun, 28 Sep 2014 14:43:03 + schrieb "Marc Schütz" : > Yeah, it wasn't a good idea. Somehow it felt strange to throw all > type safety out of the window, but on the other hand, bit-level > comparison is the purpose of `is`, which isn't typesafe to begin > with. I have the same feeling. N

Re: User-defined "opIs"

2014-09-28 Thread via Digitalmars-d
On Sunday, 28 September 2014 at 14:27:56 UTC, Marco Leise wrote: Am Sun, 28 Sep 2014 10:44:47 + schrieb "Marc Schütz" : On Saturday, 27 September 2014 at 11:38:51 UTC, Marco Leise wrote: > A byte for byte comparison of both operands is performed. > For reference types this is the refer

Re: User-defined "opIs"

2014-09-28 Thread Marco Leise via Digitalmars-d
Am Sun, 28 Sep 2014 10:44:47 + schrieb "Marc Schütz" : > On Saturday, 27 September 2014 at 11:38:51 UTC, Marco Leise wrote: > > A byte for byte comparison of both operands is performed. > > For reference types this is the reference itself. > > Maybe allow this only for types that somehow

Re: User-defined "opIs"

2014-09-28 Thread via Digitalmars-d
On Saturday, 27 September 2014 at 11:38:51 UTC, Marco Leise wrote: I'm against overloading identity checking, too. Instead I would propose to change its definition to make Proxy structs work. The rules are currently: For class objects, identity is defined as the object references are for the

Re: User-defined "opIs"

2014-09-27 Thread Marco Leise via Digitalmars-d
I'm against overloading identity checking, too. Instead I would propose to change its definition to make Proxy structs work. The rules are currently: For class objects, identity is defined as the object references are for the same object. Null class objects can be compared with is. For s

Re: User-defined "opIs"

2014-09-25 Thread Steven Schveighoffer via Digitalmars-d
On 9/24/14 6:48 PM, Meta wrote: The following code fails under DMD 2.065: struct Test { bool opBinary(string op: "is", T: typeof(null))(T val) { return false; } bool opBinaryRight(string op: "is", T: typeof(null))(T val) { return false; } } void

Re: User-defined "opIs"

2014-09-24 Thread ketmar via Digitalmars-d
On Wed, 24 Sep 2014 22:48:35 + Meta via Digitalmars-d wrote: > Is this supposed to work, and if not, should an enhancement be > made to allow it? i don't think that ER is needed. `is` is non-overloadable by design. making it overloadable will bring in the requrements for something like `is_w

Re: User-defined "opIs"

2014-09-24 Thread Meta via Digitalmars-d
On Wednesday, 24 September 2014 at 23:08:26 UTC, Adam D. Ruppe wrote: On Wednesday, 24 September 2014 at 22:48:36 UTC, Meta wrote: Is this supposed to work, and if not, should an enhancement be made to allow it? It is not supposed to work - the docs don't list is as overridable (http://dlang.

Re: User-defined "opIs"

2014-09-24 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 24 September 2014 at 22:48:36 UTC, Meta wrote: Is this supposed to work, and if not, should an enhancement be made to allow it? It is not supposed to work - the docs don't list is as overridable (http://dlang.org/expression.html look for "Identity expressions") - and I don't thi

User-defined "opIs"

2014-09-24 Thread Meta via Digitalmars-d
The following code fails under DMD 2.065: struct Test { bool opBinary(string op: "is", T: typeof(null))(T val) { return false; } bool opBinaryRight(string op: "is", T: typeof(null))(T val) { return false; } } void main() { auto t = Test(); //Error