DIP1000: 'return scope' ambiguity and why you can't make opIndex work

Dennis dkorpel at gmail.com
Tue Jul 6 09:23:59 UTC 2021


On Tuesday, 6 July 2021 at 05:15:24 UTC, Walter Bright wrote:
> This rule is arbitrary, precluding things like creating a 
> `return ref` and
> `return scope` for the same parameter.

My question is: why? Why can't we allow a ref parameter to return 
either its address or its value? Given that lifetime(address) <= 
lifetime(value) and the returned value has lifetime(address), I'm 
struggling to see where it goes wrong.


More information about the Digitalmars-d mailing list