DIP1000: The return of 'Extend Return Scope Semantics'
Dukc
ajieskola at gmail.com
Fri Jun 11 11:00:08 UTC 2021
On Saturday, 29 May 2021 at 11:32:50 UTC, Dennis wrote:
> On Tuesday, 25 May 2021 at 11:24:59 UTC, Dennis wrote:
>> We want to express:
>> ```D
>> // ┌─────────>─────────┐
>> void move(T)(return T source, ref scope T target)
>> ```
>
> Here's a simple extension idea:
> https://github.com/dlang/dmd/pull/12601
>
> Simply skip over `return` parameters when looking for the
> 'first' parameter, since making a `return` parameter its own
> destination has no use. It's still constraining the parameter
> order, but may be good enough to move forward with `move`.
This is the way to go IMO.
The potential problem is that if we later on decide we need a
more complex solution, it's going to be more complicated than if
we do it now. So we kind of have to choose right away unless we
want `move2`.
Still, ignoring return ref when choosing the output argument
sounds the best compromise for me.
More information about the Digitalmars-d
mailing list