DIP1000: The return of 'Extend Return Scope Semantics'

ZachAttack! reachzach at gmail.com
Sun Jun 13 11:59:49 UTC 2021


On Friday, 11 June 2021 at 10:27:19 UTC, Dennis wrote:
> On Friday, 11 June 2021 at 03:12:29 UTC, Walter Bright wrote:
>> Hence a simple solution:
>>
>> Make move() @trusted.
>
> I don't think that makes sense. `move` is `@safe` anyway for 
> non-scope inputs, and for scope inputs you wouldn't want it to 
> lie about its interface (pretending it's `scope` when it 
> isn't). Also you don't want it to call a `@system` move 
> constructor in `@safe` code.
>
>> Write an @safe alternative to move() with the parameters 
>> swapped.
>
> What would that alternative be called?

Challenge: Provide a code example illustrating how the existing 
variant of `move` compiles when it shouldn't—or errors when it 
shouldn't—while the alternative form works correctly.

I actually couldn't do it... it may be harder than we suspect.


More information about the Digitalmars-d mailing list