DIP64: Attribute Cleanup

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 20 14:40:29 PDT 2014


On Fri, 20 Jun 2014 15:22:02 -0400, Brian Schott <briancschott at gmail.com>  
wrote:

> http://wiki.dlang.org/DIP64
>
> Attributes in D have two problems:
> 1. There are too many of them and declarations are getting too verbose
> 2. New attributes use @ and the old ones do not.
>
> I've created a DIP to address these issues.

I like it.

At first, I thought "hm.., every project is going to have their own  
definition for @safe @pure @nothrow," but we can put one in druntime  
common sets that everyone should use, and we already allow custom  
attributes anyway that have to be looked up.

One thing this will make slightly more difficult is looking for e.g.  
@trusted functions, because you can't just grep for them. However, I think  
with DScanner, you can probably find things easy enough.

2 thoughts:

1. On H.S.Teoh's idea to add negation, what does foo() @pure !@pure mean  
(or if my preferred syntax was accepted, @pure @pure(false) )?
2. What does this print?

@myattr = @safe @pure;

void foo() @myattr {}

pragma(msg, (&foo).typeof);

-Steve


More information about the Digitalmars-d mailing list