[Issue 14389] The "(attributelist):" attribute notation scope of effect
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Apr 1 13:19:54 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14389
--- Comment #2 from Daniel Čejchan <czdanol at gmail.com> ---
@Adam D. Ruppe:(In reply to Adam D. Ruppe from comment #1)
> class C {
> private:
> @safe:
> void foo() {}
> }
>
> Should foo still be private? I think a lot of people use this pattern today
> and expect foo to be private and @safe. Your change would make the @safe
> turn private off.
>
> You expanded on chat to say it should be written
>
> private @safe:
> void foo() {}
>
> if you want both, put them both behind the colon. That's not a bad idea,
> I'll admit.
The problem is:
class C {
private:
@safe:
void foo() {}
public:
void asd() {} // I don't want this stuff to be @safe!
}
And, if by any chance, you'd want to ALL the stuff be safe, you'd use my other
suggestion:
class C {
@safe::
private:
void foo() {}
public:
void asd() {} // Aalso safe
}
--
More information about the Digitalmars-d-bugs
mailing list