Discussion Thread: DIP 1035-- at system Variables--Community Review Round 2
timon.gehr at gmx.ch
Fri Feb 26 10:53:39 UTC 2021
On 26.02.21 11:08, Walter Bright wrote:
> On 2/26/2021 1:57 AM, Walter Bright wrote:
>> 2. disallow void initialization if the struct has an invariant
> Thinking about this some more.
> An invariant specifies a subset of values that the fields could have,
> while a void initialization means any random values are acceptable.
> Therefore (2) makes sense.
An invariant is anything that remains true throughout the execution, and
it's not always easy to check. (2) makes sense, but it's not a
substitute for @system fields. @safe code shouldn't be able to mess with
unsafe values at all, not only through `void` initialization, and
@system code should be able to define its own unsafe values.
More information about the Digitalmars-d