The issue is not with aliases, accessability already has a natural grey
area:

====================
module lib;

private struct Foo {}

// Should any of these be allowed?
public Foo getFoo() { return Foo(); }
public void takeFoo(Foo f) {}
struct Bar
{
    Foo f;
}

------

module main;
import lib;

getFoo();  // Allowed?

takeFoo(getFoo());  // Allowed?

Bar b;  // Allowed?

takeFoo(b.f);   // Allowed?

b.f = getFoo();   // Allowed?

// Allowed? If so, can you *do* anything with x?
auto x = getFoo();

====================

The solution seems to be to check protection only during symbol lookup.
Thus all of the above are allowed and you can do with x what Foo allows you to
(aggregates default to public protection).

Reply via email to