DIP1000: The return of 'Extend Return Scope Semantics'

Walter Bright newshound2 at digitalmars.com
Fri Jun 11 03:12:29 UTC 2021


On 5/25/2021 4:24 AM, Dennis wrote:
> [...]

Thanks for a good explanation of the issue. Well done!

In practice from what I see, the normal use is:

    stack.push(value)
    container.add(element)
    array.append(element)
    buffer.write(value)

and rather overwhelmingly so, although I did not collect statistics. (The `this` 
reference is considered the first parameter.)

The move example is one counterexample.

There's tremendous value in doing the common case in a simple manner, rather 
than trying to accommodate every case by adding a great deal of complexity to 
the language and compiler. There's value not just in simplicity, but a follow on 
effect in having diverse code organized in predictable ways.

Hence a simple solution:

Make move() @trusted.

Write an @safe alternative to move() with the parameters swapped.



More information about the Digitalmars-d mailing list