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

Steven Schveighoffer schveiguy at gmail.com
Fri Jan 25 15:36:39 UTC 2019


On 1/25/19 5:57 AM, kinke wrote:
> 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.
> 
> There is no individual gate, there's just one to rule the 
> caller-destruction of all temporaries. That's the current state, and 
> there's no need for that to change. I was trying to say that a rewrite 
> as expression, as requested as part of the assessment, clearly isn't 
> enough, as the dtor expressions aren't visible this way, and neither is 
> the scoping (when the dtor expression of `__pfx` comes into play etc.).

I think the point of the DIP is not to lower expressions. It makes no 
sense to, they have to be statements (just like all temporaries live 
until the end of a statement).

-Steve


More information about the Digitalmars-d-announce mailing list