Why aren't function attributes inferred?
Steven Schveighoffer
schveiguy at yahoo.com
Mon Aug 22 04:24:15 PDT 2011
On Sat, 20 Aug 2011 20:23:44 -0400, Jonathan M Davis <jmdavisProg at gmx.com>
wrote:
> On Saturday, August 20, 2011 16:50:32 Sean Eskapp wrote:
>> Since the compiler can clearly tell when a function is not const, safe,
>> pure, or nothrow, why can't they just be assumed, unless proven
>> otherwise?
>
> As of 2.054, @safe, pure, and nothrow are inferred for delegates and
> templated
> functions. This is because whether they can be @safe, pure, or nothrow
> depends
> entirely on the types that they're instantiated with. For normal
> functions,
> there is no such inferrence. It's not needed.
Well, and also because you can't template purity, @safety, and um...
nothrow-ity :)
-Steve
More information about the Digitalmars-d-learn
mailing list