Object.opEquals, opCmp, toHash

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Feb 16 09:38:54 PST 2012


On Thu, Feb 16, 2012 at 12:35:20AM -0800, 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?

Nope.


> One reason is memoization, aka lazy initialization, aka logical
> const. I don't believe these are worth it. If you must do it inside
> those functions (and functions that override them), you're on your
> own to make it work right (use unsafe casts, etc.).

This is a non-problem once the compiler implements memoization as an
optimisation. Which it can't until we go ahead with this change. This is
the direction that we *should* be going anyway, so why not do it now
rather than later?


T

-- 
Latin's a dead language, as dead as can be; it killed off all the
Romans, and now it's killing me! -- Schoolboy


More information about the Digitalmars-d mailing list