On Friday, 18 May 2018 at 12:16:55 UTC, aliak wrote:

You may not need a new word at all. You can also enhance private to take arguments. Package already does this. You can give private a symbol list that says which symbols this is private for. So:

class A {
  private int x;
  private(A) int y;
}
void main() {
  A a = new A();
  a.x = 7; // ok, it's private to module
  a.y = 3; // error, it's sealed to class
}

Cheers,
- Ali

Don't really have a stake in the convo, but I'll jump in to say this looks like a solid solution to me (also agree 'this' instead of classname).

Reply via email to