toHash => pure, nothrow, const, @safe

Marco Leise Marco.Leise at gmx.de
Mon Mar 12 02:31:02 PDT 2012


Am Mon, 12 Mar 2012 07:06:33 +0100
schrieb Alex Rønne Petersen <xtzgzorex at gmail.com>:

> I should point out that I *do* think the idea is good (i.e. if you want 
> the "bad" things, that's what you have to declare), but it's just too 
> late now. Also, there might be issues with const and the likes - should 
> the system assume const or immutable or inout or...?

"@safe pure nothrow" as default could have worked better than manually setting it, I agree. @safe can be set at module level, so it is less of an issue to make it the default in your code. The problem with those attributes is not that pure is used more often than impure or nothrow more often than throws, but that they need to be set transitive in function calls. And even though the attributes do no harm to the user of the function (unlike immutable) they can easily be forgotten or left away, because it is tedious to type them.

-- 
Marco



More information about the Digitalmars-d mailing list