`restricted` member variables

The Zealot zod at zod.zod
Tue Jun 21 10:29:15 UTC 2022


On Tuesday, 21 June 2022 at 08:40:28 UTC, Max Samukha wrote:
> On Tuesday, 21 June 2022 at 08:37:55 UTC, Max Samukha wrote:
>
>> class E
>> {
>>   void(int newY) {
>>     this int y; // 'this' as storage class will likely be 
>> grammatically ambiguous
>>     newY = y;
>>   }
>> }
>>
>
> Typo. Should be:
>
> ```d
> class E
> {
>     void(int newY) {
>         this int y;
>         y = newY;
>     }
> }
> ```

this won't solve the 'problem' if the variable has to be accessed 
by multiple functions.
Anyway, i don't think this feature is needed at all. if you run 
into those problems, you are likely packing too many things into 
a single class, and you likely should move them to a seperate 
struct in a seperate module.


More information about the Digitalmars-d mailing list