Class attributes
Basile B. via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Oct 2 10:22:57 PDT 2016
On Sunday, 2 October 2016 at 15:54:38 UTC, Satoshi wrote:
> Hello,
>
> why
> pure @safe nothrow @nogc struct Point {
> }
>
> isn't same as
>
> struct Point {
> pure: @safe: nothrow: @nogc:
> }
>
> ??
This is not specified but attributes aren't applied to the scope
created by the declaration. Which is a good thing, for example
with the visibility attributes it would be a problem, imagine the
following declarations:
struct Foo(T)
{
private struct Range // imagine that private as a inner
"private:"
{
void popFront(); // would be private !!
bool empty(); // would be private !!
T front(); // would be private !!
}
}
So this is really not something anyone would want.
More information about the Digitalmars-d-learn
mailing list