object.opEquals return type
Lars Ivar Igesund
larsivar at igesund.net
Sun Feb 24 07:20:40 PST 2008
Janice Caron wrote:
> On 24/02/2008, Edward Diener <eddielee_no_spam_here at tropicsoft.com> wrote:
>> Why is the return type of object.opEquals an 'int' rather than a 'bool' ?
>
> I haven't the faintest idea. However, I have submitted to bugzilla
> that the signature of opEquals (and opCmp, toString, etc.) should be
> fixed for const correctness. Perhaps the return type could be changed
> to bool in the same move? As in
>
> const bool opEquals(const(Object) o)
Walter belive that an int is more efficient. In a long thread a year or two
ago, it was shown that this is not the case, but Walter did not provide
further comments. I even think that the int return can cause severe
problems for templated solutions where opEquals is in use.
We tried to fix this in Tango, but apparently the int is hardcoded in the
compiler.
--
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
More information about the Digitalmars-d
mailing list