RfC for language feature: rvalue struct

FeepingCreature feepingcreature at gmail.com
Wed Feb 1 11:26:17 UTC 2023


On Wednesday, 1 February 2023 at 09:29:01 UTC, Ola Fosheim 
Grøstad wrote:
> On Wednesday, 1 February 2023 at 07:46:24 UTC, FeepingCreature 
> wrote:
>> Maybe it can be done as a rewrite?
> […]
>> But this is not quite the semantic we actually want because, 
>> for instance, the accessors will still run the invariants, 
>> which is pointless because we know the fields won't ever 
>> change after the constructor call, and also the function call 
>> itself is just useless. But that's the interface we want, at 
>> least.
>
> Hm, anyway, if you can do it as a rewrite then you should be 
> able to implement it in the parser and in the runtime. That way 
> you can maintain it even if it isn't added to the core D 
> language.
>
> (If you are interested in something like this, just send me an 
> email.)

I mean, since it's a *reduction* in capability, it would even be 
enough to do it as an audit step. Error on any assignment to a 
field in the struct marked with a UDA.

That can't be done before semantic assignment though...


More information about the Digitalmars-d mailing list