toHash => pure, nothrow, const, @safe

Martin Nowak dawg at dawgfoto.de
Mon Mar 12 07:06:45 PDT 2012


On Mon, 12 Mar 2012 10:40:16 +0100, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 3/12/2012 1:08 AM, Martin Nowak wrote:
>> What's wrong with auto-inference. Inferred attributes are only  
>> strengthening
>> guarantees.
>
> Auto-inference is currently done for lambdas and template functions -  
> why? - because the function's implementation is guaranteed to be visible  
> to the compiler. For other functions, not so, and so the attributes must  
> be part of the function signature.

A "@safe pure nothrow const" might be used as "@system".
That means someone using a declaration may have a different view
than someone providing the implementation.

Those interface boundaries are also a good place for by-hand annotations
to provide explicit API guarantees and enforce a correct implementation.

Though another issue with inference is that it would require a
depth-first-order for the semantic passes.

I also hope we still don't mangle inferred attributes.


More information about the Digitalmars-d mailing list