Extending D's support for object-oriented design with private(this)
Kagamin
spam at here.lot
Fri Apr 26 13:53:19 UTC 2024
On Friday, 26 April 2024 at 06:39:31 UTC, NotYouAgain wrote:
> In anticipation of this new question (what happens it you use
> private(this) in global scope?
>
> I can answer this below (in code):
>
> module m;
> @safe:
>
> import std;
>
> private(this) int x; // Error: visibility attribute
> `private(this)` cannot be used in global scope
>
> void main(){}
Conceptually module is a class, so its visibility design can
follow nested class design.
More information about the dip.ideas
mailing list