Should pure nothrow ---> @pure @nothrow ?

Ary Borenszweig ary at esperanto.org.ar
Fri Nov 27 07:43:35 PST 2009


Don wrote:
> #ponce wrote:
>>> Definitely. And what about @deprecated and @override?
>>
>> As override is now required, i don't think it should be an attribute.
> 
> As I understand it, one of the characteristics of attributes is that you 
> should be able to remove them from the entire program, without affecting 
> the behaviour.

This is not correct. For example in C# you have the Flags attribute for 
enums:

enum Foo {
   One = 1,
   Two = 2,
   Three = 4,
}

You can't do:

var x = Foo.One | Foo.Two;

but if you do:

[Flags]
enum Foo { ... }

you can do it now.

Also see this: 
http://msdn.microsoft.com/en-us/library/system.flagsattribute(VS.71).aspx

Removing the Flags attribute changes program behaviour. An attribute, 
indeed, tells someone (the compiler, the programmer, an external tool) 
that a symbol has some attribute. It could change the program if the 
compiler is the one using that attribute. So in theory every attribute 
in D could be an @attribute.



More information about the Digitalmars-d mailing list