Object.opEquals, opCmp, toHash

deadalnix deadalnix at gmail.com
Thu Feb 16 08:50:26 PST 2012

Le 16/02/2012 16:52, Timon Gehr a écrit :
> On 02/16/2012 09:35 AM, Walter Bright wrote:
>> These all need to be:
>> const pure nothrow @safe
>> Unless this is done, the utility of const, pure, nothrow and @safe is
>> rather crippled.
>> Any reason why they shouldn't be?
> The utility of const, pure, nothrow and @safe is already rather crippled
> when using Phobos. It is a rather small minority of my pure functions
> that are effectively annotated pure, because most of Phobos is not
> properly annotated and the inference for templates does not work
> satisfactorily yet.
> So imo, making opEquals, opCmp, toHash const pure nothrow @safe is
> blocked by properly annotating Phobos as well as the following issues:
> Bugs in existing attribute inference:
> http://d.puremagic.com/issues/show_bug.cgi?id=7205
> http://d.puremagic.com/issues/show_bug.cgi?id=7511
> Enhancement required for making templates const correct:
> http://d.puremagic.com/issues/show_bug.cgi?id=7521

Good point. However, I don't think that should stop us.

BTW, what should happen if we write a opComp that isn't nothrow, @safe 
or pure ?

More information about the Digitalmars-d mailing list