DIP1000: Walter's proposal to resolve ambiguity of ref-return-scope parameters

Dennis dkorpel at gmail.com
Thu Nov 25 16:11:39 UTC 2021


On Thursday, 25 November 2021 at 15:57:13 UTC, WebFreak001 wrote:
> with `return ref` and `return scope`, will there also be a 
> `return this` for the case like the opIndex functions returning 
> something with the lifetime of the containing struct? I don't 
> quite get how it's otherwise fixing it.

`return this` in struct member functions is `return ref`. Walter 
proposes in the bugzilla issue to allow `ref` after the parameter 
list:

```D
struct S {
     ref int opIndex() return ref scope {

     }
}
```




More information about the Digitalmars-d mailing list