DIP1000: 'return scope' ambiguity and why you can't make opIndex work
ag0aep6g
anonymous at example.com
Sat Jun 19 14:48:45 UTC 2021
On Saturday, 19 June 2021 at 14:39:01 UTC, Dukc wrote:
> It's simpler and better if `return` attribute outside the
> parameter list always binds to `this`. Unless there is some
> reason you might want to annotate the return type as `return`?
> I can't think of any.
I think you misunderstand. `return` does bind to `this`. But it
can bind to two different aspects of `this`: (1) `ref` or (2)
`scope`.
Currently, you cannot freely choose which aspect of `this` you
want to be `return`. The `opIndex` example fails because `return`
is applied to the wrong aspect, and the programmer can't override
it.
More information about the Digitalmars-d
mailing list