RfC for language feature: rvalue struct
FeepingCreature
feepingcreature at gmail.com
Tue Jan 31 07:31:58 UTC 2023
On Monday, 30 January 2023 at 20:15:48 UTC, Dukc wrote:
> I don't see a need for fields to be non-referenceable since
> immutability protects them if the data in question is already
> committed.
Yes, again, the idea is that rvalue allows *overwriting mutable
variables* of this type.
```
rvalue struct S {
int a;
}
S s;
s = S(5);
s = S(6);
```
Which `immutable` does not allow.
And this is important because this idiom is inescapable, it will
always crop up (all over std.algorithm causing compile errors for
our immutable structs, cough), and in fact I increasingly think
it's just *good.* It's an inherent part of D's C heritage.
More information about the Digitalmars-d
mailing list