DIP1000: The return of 'Extend Return Scope Semantics'

Walter Bright newshound2 at digitalmars.com
Sat Jun 12 23:21:02 UTC 2021


On 6/11/2021 3:27 AM, 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?
> 

Consider:

    a = b;

Naturally, it moves right to left. We already have a word for that in the 
library, "emplace".


More information about the Digitalmars-d mailing list