DIP 1016--ref T accepts r-values--Community Review Round 1

Dukc ajieskola at gmail.com
Fri Jul 20 16:39:46 UTC 2018


On Friday, 20 July 2018 at 09:39:47 UTC, Nicholas Wilson wrote:
>> appending something (like .byRef or byRef!long, the latter 
>> making an implicit type conversion)
>
> That can't work: either it returns an expired stack temporary 
> (*very* bad), or allocates with no way to deallocate (bad).

How so? It could be made it act exactly as if the temporary was 
made just before the function call, meaning the lifetime would 
end at the end of current scope.

Of course, this required compiler magic. A library solution would 
have exactly the limits you said.



More information about the Digitalmars-d mailing list