accept @pure @nothrow @return attributes

Kenji Hara via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 26 07:25:26 PST 2015


2015-01-27 0:07 GMT+09:00 Jonathan M Davis via Digitalmars-d <
digitalmars-d at puremagic.com>:

> On Monday, January 26, 2015 13:21:54 via Digitalmars-d wrote:
> > One meaning would be to only use "@" with attributes that do not
> > affect computation, typing, overloading etc and use it only for
> > safety-checks and optimization hints (like inlining).
>
> All of the existing @ affect the type of the function. It's attributes like
> public or static which don't, and those still affect aspects of compilation
> and can easily cause compilation errors. There are not currently any
> attributes which are simply hints to the compiler, and the ones which
> affect
> the safety checks are _definitely_ part of the type of the function. So, I
> don't think that that particular distinction would work, even if we could
> freely rearrange which attributes had @ and which didn't.
>

Additional note: UDA can be attached to symbols only.

void foo() @uda {}
// __traits(getAttributes, foo) == (uda)
// pragma(msg, typeof(foo)); prints void(), no @uda

void function() @uda fp;
// Error: user defined attributes cannot appear as postfixes

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150127/9ec21b6b/attachment.html>


More information about the Digitalmars-d mailing list