digitalmars.D.bugs - [Issue 288] New: type of opEquals
- d-bugmail puremagic.com (39/50) Aug 15 2006 http://d.puremagic.com/issues/show_bug.cgi?id=288
- d-bugmail puremagic.com (12/12) Aug 17 2006 http://d.puremagic.com/issues/show_bug.cgi?id=288
- Thomas Kuehne (11/16) Aug 18 2006 -----BEGIN PGP SIGNED MESSAGE-----
- d-bugmail puremagic.com (4/4) Sep 03 2008 http://d.puremagic.com/issues/show_bug.cgi?id=288
- d-bugmail puremagic.com (9/9) Apr 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=288
http://d.puremagic.com/issues/show_bug.cgi?id=288
Summary: type of opEquals
Product: D
Version: 0.163
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: thomas-dloop kuehne.cn
Bruno Medeiros schrieb am 2006-08-14:
I don't think this test case is correct. You test the type-of a TypeInfo
(which is an Object) equality operation vs the type-of an int(which is a
primitive type) equality operation. Nothing says that such type-of
should be the same (even though I very much think it should).
What I do think is not correct is the following (second line) :
writefln( typeid(typeof(typeid(int) == typeid(char))) );// int
writefln( typeid(typeof(typeid(int) == typeid(int))) );//bool INCORRECT?
writefln( typeid(typeof(new Object == new Object)) ); // int
writefln( typeid(typeof(typeid(int) != typeid(char))) ); // bool
writefln( typeid(typeof(typeid(int) != typeid(int))) ); // bool
writefln( typeid(typeof(new Object != new Object)) ); // bool
http://www.digitalmars.com/d/expression.html#EqualExpression
Thus samples 1 and 3 are incorrect.
Sources with issues:
dmd-0.164/src/dmd/typinf.c:341: * int function(void*,void*) xopEquals;
dmd-0.164/src/phobos/std/bitarray.d:289: int opEquals(BitArray a2)
dmd-0.164/src/phobos/std/boxer.d:323: bool opEquals(Box other)
dmd-0.164/src/phobos/object.d:23: int opEquals(Object o);
dmd-0.164/src/phobos/object.d:109: int function(void*,void*) xopEquals;
dmd-0.164/src/phobos/internal/object.d:123: int opEquals(Object o)
dmd-0.164/src/phobos/internal/object.d:181: int opEquals(Object o)
dmd-0.164/src/phobos/internal/object.d:570: int function(void*,void*)
xopEquals;
Added to DStress as
http://dstress.kuehne.cn/run/o/opEquals_05_A.d
http://dstress.kuehne.cn/run/o/opEquals_05_B.d
http://dstress.kuehne.cn/run/o/opEquals_05_C.d
http://dstress.kuehne.cn/run/o/opEquals_05_D.d
http://dstress.kuehne.cn/run/o/opEquals_05_E.d
http://dstress.kuehne.cn/run/o/opEquals_05_F.d
http://dstress.kuehne.cn/run/o/opEquals_05_G.d
http://dstress.kuehne.cn/run/o/opEquals_05_H.d
--
Aug 15 2006
http://d.puremagic.com/issues/show_bug.cgi?id=288
smjg iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg iname.com
AIUI all expressions involving == and != are supposed to be of type bool.
The fact that Object.opEquals is of type int is another matter. See
digitalmars.D.bugs:7933, "int opEquals(Object), and other legacy ints". Walter
claimed it's "for efficiency reasons", but the cited efficiency reasons don't
work here for as long as it's opEquals rather than opNotEquals.
--
Aug 17 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail puremagic.com schrieb am 2006-08-17:http://d.puremagic.com/issues/show_bug.cgi?id=288AIUI all expressions involving == and != are supposed to be of type bool. The fact that Object.opEquals is of type int is another matter.http://www.digitalmars.com/d/expression.html#EqualExpressionFor class and struct objects, the expression (a == b) is rewritten as a.opEquals(b), and (a != b) is rewritten as !a.opEquals(b)Thus opEquals should return a boolean result. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFE5YffLK5blCcjpWoRArZnAJ968NiHssrxp64Laey3wuAUXHKBvwCfeA74 w9FDlhgZht5/ii3rQAqHNN0= =szwS -----END PGP SIGNATURE-----
Aug 18 2006
http://d.puremagic.com/issues/show_bug.cgi?id=288 *** Bug 1989 has been marked as a duplicate of this bug. *** --
Sep 03 2008
http://d.puremagic.com/issues/show_bug.cgi?id=288
gide nwawudu.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Fixed in D2.016, D1 is keeping 'int opEquals' for backwards compatibility.
--
Apr 03 2009









Thomas Kuehne <thomas-dloop kuehne.cn> 