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

Nicholas Wilson iamthewilsonator at hotmail.com
Fri Jul 20 23:19:08 UTC 2018


On Friday, 20 July 2018 at 16:39:46 UTC, Dukc wrote:
> 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.
>

... which is exactly what this DIP proposes ...

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

... and why its a DIP, and not a phobos PR.


More information about the Digitalmars-d mailing list