Object.opEquals, opCmp, toHash

Stewart Gordon smjg_1998 at yahoo.com
Thu Feb 16 04:24:39 PST 2012


On 16/02/2012 08:35, 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?
>
> One reason is memoization, aka lazy initialization, aka logical const.
<snip>

But if the method is pure, the compiler can automatically implement this as an optimisation.

Stewart.


More information about the Digitalmars-d mailing list