Editions Ideas
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Fri Dec 26 01:28:45 UTC 2025
On 26/12/2025 2:14 PM, Vladimir Panteleev wrote:
> On Friday, 26 December 2025 at 00:57:52 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
>> " 4. OpAssign position: prop op= exp
>> -- In this case, the whole expression is rewritten to {auto val=prop;
>> val op= exp; return prop=val; }(), where 'val' is choosen such that it
>> does not occur free in exp or prop."
>
> LGTM
>
>> If you use the setter you will need more temporaries if the type changes,
>
> So don't allow the type to change?
>
>> or make it inaccessible if it returns void.
>
> I think that is perfectly fine? void-returning setters should be
> discouraged for copyable types, but are exactly correct for non-copyable
> types
The issue with both of these is they are additional special case rules.
This is something that is discouraged where possible and it is possible
here.
Whereas what I proposed is a simple 1:1 swap of something that would
have to exist for it to work.
More information about the Digitalmars-d
mailing list