toHash => pure, nothrow, const, @safe

James Miller james at aatch.net
Mon Mar 12 01:14:52 PDT 2012


On 12 March 2012 21:08, Martin Nowak <dawg at dawgfoto.de> wrote:
> On Mon, 12 Mar 2012 07:04:52 +0100, Alex Rønne Petersen
> <xtzgzorex at gmail.com> wrote:
>
>> Or, as a compromise, perhaps the compiler can auto-infer most of the
>> attributes without any further effort from the user.
>>  No, that has API design issues. You can silently break a guarantee you
>> made previously.
>
>
> What's wrong with auto-inference. Inferred attributes are only strengthening
> guarantees.

One problem I can think of is relying on the auto-inference can create
fragile code. You make a change in one place without concentrating and
suddenly a completely different part of your code breaks, because it's
expecting pure, or @safe code and you have done something to prevent
the inference. I don't know how much of a problem that could be, but
its one I can think of.

--
James Miller


More information about the Digitalmars-d mailing list