On Friday, 18 May 2018 at 16:24:24 UTC, Gheorghe Gabriel wrote:
On Friday, 18 May 2018 at 15:57:06 UTC, bachmeier wrote:
On Friday, 18 May 2018 at 15:40:52 UTC, KingJo

class A {
   private int x;
   private(this) int y;
}


I agree that this looks a bit strange.
My initial proposal was "sealed" instead "private(this)" today.

Mmm.. that brings me back to the idea of sealed at the class level again.

class A
{
   private int x;
private(this) int y; // imagine if you have lots of private variables. // this could become pretty anoying - and kinda redundant.
}

class A
{
   private int x;
sealed int y; // again, what if you have lots of private variables that
                 // that you really want sealed.
}


// Now. Back to the idea of sealed.
// abosolute consistency of your private variables.
// no redundancy.
// no some 'private', some 'sealed' confusion.
// no some 'private' (but really public) some 'private(this) .. confusion.
//
sealed class A{
    private int x;
    private int y;
}

downside, is adding a new keyword, and getting agreement on what that new keyword should be.

So I've come full circle again, and believe my idea is worth further consideration.

Reply via email to