`restricted` member variables
deadalnix
deadalnix at gmail.com
Thu Jun 23 01:35:40 UTC 2022
On Thursday, 23 June 2022 at 01:27:23 UTC, Mike Parker wrote:
> On Thursday, 23 June 2022 at 01:19:11 UTC, forkit wrote:
>> On Thursday, 23 June 2022 at 01:13:22 UTC, forkit wrote:
>>>
>>> ...
>>> In D, the `invariant` feature allows you to maintain the
>>> invariants of any class from within the class.
>>> ..
>>
>> On re-reading that part again, I'm confused as to what it
>> means.
>>
>> What is this 'invariant' feature you mention?
>
> https://dlang.org/spec/class.html#invariants
>
> A class in its own module can fully maintain its invariants,
> even when multiple methods modify a variable. Every function
> call is bookended with the invariant check.
>
So obviously, the problem here is that the scoping for invariant
check is wrong. But you already started a thread about this, so I
assume you understand this fairly well.
More information about the Digitalmars-d
mailing list