[Issue 14389] The "(attributelist):" attribute notation scope of effect

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 2 01:33:54 PDT 2015


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

--- Comment #6 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
simply resetting 'em all is messy too: then i have to repeat all that `@safe
nothrow @nogc` yet again when i changed visibility from `private` to `public`,
for example.

and making visibility resets only visibility is even worse, 'cause now i have
to remember what resets what.

on the other side, "unattributing" is really necessary, as there is no way to
"undo" some attributes at all.

sure, this is a matter of taste. i agree that `attr { ... }` is making code
ugly, and i try to avoid writing that when it is possible. but double colons
are very easy to miss (and mistype).

yet i see another possibility! ;-)

class A {
@safe: // this will last forever
(nothrow): // and this will be reset on next `id:` or `(id):`
}

this way it's easy to notice what is what, and using `()` suggests at least
something. for me it tells "hey, i'm not permanent, hence the brackets here!"

--


More information about the Digitalmars-d-bugs mailing list