DIP 1022---foreach auto ref---Final Review

Manu turkeyman at gmail.com
Sun Dec 1 12:58:53 UTC 2019


On Sun, Dec 1, 2019 at 8:35 PM Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> We are working on a comprehensive solution to the copy, move, and forward
> problem with function parameters. This naturally leads into under what
> conditions are the foreach ranges copied, moved, or forwarded to the foreach
> variable?
>
> I'm concerned that we seem to now have a mess over what ref actually means. There's:
>
> a) pre- and post- DMD 2.088 behavior of ref in foreach (as noted in the DIP, but
> there's no reference to the DIP for that change).
>
> b) `auto ref` for function parameters
>
> c) `auto ref` for function return values
>
> d) rvalues being promoted to `ref` for function parameters
> https://gist.github.com/andralex/e5405a5d773f07f73196c05f8339435a
> https://digitalmars.com/d/archives/digitalmars/D/Binding_rvalues_to_ref_parameters_redux_325087.html
> Implementation: https://github.com/dlang/dmd/pull/9817
>
> I suggest putting this on hold until we have a comprehensive solution to
> function parameter copying, moving, and forwarding so we don't have to re-do
> foreach yet again after this DIP.

I completely agree with this.


More information about the Digitalmars-d mailing list