www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14389] New: The "(attributelist):" attribute notation scope

https://issues.dlang.org/show_bug.cgi?id=14389

          Issue ID: 14389
           Summary: The "(attributelist):" attribute notation scope of
                    effect
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: czdanol gmail.com

Hey,

it might have been discussed anywhere, but anyway, I strongly believe that
attributes defined via "(attributeList):" notation should only be applied only
up to another "(attributeList):" notation (in the current scope level), not up
to the end of the current scope.

I don't really see a reason why it is like this. It is uninuitive. Especially
when it works well with public/protected/private, but with everything else not.

Consider this code:

class C {

public  (5):
    int a;
    int b;

private:
    int c;

}

pragma( msg, __traits( getAttributes, C.c ) );

If you check the compiler log, you find out that C.c has also an attribute 5.
It's really depressing for me, forcing me to use the "(attributeList) { }"
notation, which kinda ruins the nice flow of the code.

If you really insist on having this feature, I'd suggest making it into
"(attributeList)::" notation.

So, please, PLEASE, do this right, or prove me wrong :)

Thanks,
your friendly neighbour Danol.

--
Apr 01 2015