Negation of attributes (DIP 79)

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 3 14:19:19 PDT 2015


On Tuesday, 2 June 2015 at 10:29:35 UTC, Daniel Kozak wrote:
> I am working on dip which will try to addressed negation of 
> attributes issue.
> http://wiki.dlang.org/DIP79

You need to iron out what happens with attributes like 
@safe/@trusted/@system or public/protected/package/private. 
Simply turning them on and off doesn't really work.

Regardless, I think that attribute(boolean expression) is the 
clear winner, because it's for more flexible. Without the ability 
to provide a boolean expression, some code will be forced to use 
compile-time introspection to determine which attributes are 
enabled and then enable or disable them as appropriate in 
different static if branches. That sort of case is really only 
going to pop up in generic code, but once you start turning 
attributes on and off, I fully expect that it will come up, in 
which case, a syntax such as !final won't work very well.

Also, Andrei has expressed interest in the attribute(boolean 
expression) syntax in the past, so that syntax has at least some 
support from him.

- Jonathan M Davis


More information about the Digitalmars-d mailing list