toHash => pure, nothrow, const, @safe

Alex Rønne Petersen xtzgzorex at gmail.com
Mon Mar 12 06:23:28 PDT 2012


On 12-03-2012 14:16, deadalnix wrote:
> Le 12/03/2012 13:51, Alex Rønne Petersen a écrit :
>> On 12-03-2012 10:40, Walter Bright 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.
>>
>> Isn't auto-inference for templates a Bad Thing (TM) since it may give
>> API guarantees that you can end up silently breaking?
>>
>
> As long as you can explicitly specify that too, and that you get a
> compile time error when you fail to provide what is explicitly stated,
> this isn't a problem.

But people might be relying on your API that just so happens to be pure, 
but then suddenly isn't!

-- 
- Alex


More information about the Digitalmars-d mailing list