DIP1000: Walter's proposal to resolve ambiguity of ref-return-scope parameters
Paul Backus
snarwin at gmail.com
Fri Nov 26 00:26:35 UTC 2021
On Thursday, 25 November 2021 at 21:07:50 UTC, Dennis wrote:
> On Thursday, 25 November 2021 at 20:45:41 UTC, Stanislav Blinov
> wrote:
>> https://dlang.org/spec/function.html#parameters needs to get
>> __simpler__, not turn into a PhD thesis, which it is already
>> well on the way to.
>
> My proposal (as mentioned in the issue) is that `return` in any
> other position than directly before `scope` refers to
> return-ref, so only `return scope` results in return-scope.
> [...]
>
> What do you propose?
If I ever have to explain to someone in the Learn forum why
`scope return` means something different from `return scope`, I
will cry.
More seriously: this is exactly the kind of obscure "gotcha" that
makes C++ so beginner-hostile, and IMO it is worth going to
considerable lengths (including breaking changes) to avoid it.
More information about the Digitalmars-d
mailing list