Parameter storage classes on foreach variables
Timon Gehr
timon.gehr at gmx.ch
Mon May 20 21:25:43 UTC 2024
On 5/20/24 16:29, Nick Treleaven wrote:
> On Saturday, 18 May 2024 at 22:43:48 UTC, Timon Gehr wrote:
>>> If mutating in place is desired, `ref` is an excellent choice.
>>> However, if mere copy avoiding is desired, another great option would
>>> be `in`.
>>
>> I contest that `in` is a great option every time mere avoiding of
>> copies is desired (because it implies transitive `const`).
> ...
The negation is in the word "contest".
(Stated more clearly: Sometimes `in` cannot be used because `const` is
transitive.)
> Did you mean "isn't a great option"?
> And if so, presumably we still need `auto ref`:
> https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1022.md
> ...
Would be good, also for local variables outside of `foreach`.
More information about the dip.ideas
mailing list