DIP 1016--ref T accepts r-values--Formal Assessment

Nicholas Wilson iamthewilsonator at hotmail.com
Fri Jan 25 00:06:47 UTC 2019


On Thursday, 24 January 2019 at 23:59:30 UTC, Walter Bright wrote:
> On 1/24/2019 1:03 PM, kinke wrote:
>> (bool __gate = false;) , ((A __pfx = a();)) , ((B __pfy = 
>> b();)) , __gate = true , f(__pfx, __pfy);
>
> There must be an individual gate for each of __pfx and pfy. 
> With the rewrite above, if b() throws then _pfx won't be 
> destructed.
>
> (All this rigamarole is part of why exception handling isn't 
> free, even in the happy case.)

Indeed, and thats why it should be have exactly the same as if 
there were no `ref` involved, except for the not copying stuff. 
Behaving and differently is, a) wrong and, b) going to cause a 
lot of confusion.


More information about the Digitalmars-d-announce mailing list