What should happen here?

Daniel N no at public.email
Sun Sep 26 07:49:46 UTC 2021


On Sunday, 26 September 2021 at 02:15:53 UTC, Walter Bright wrote:
> On 9/25/2021 12:28 PM, Elronnd wrote:
>> Indeed; additionally, 'scope c = new Class()' _does_ follow 
>> RAII.
>
> That's more of an optimization than a semantic shift.

// This works fine...
scope c = new Class()

// I hope this works, otherwise it violates the 'law of least 
surprise'
auto c = new Class()
scope(exit) destroy(c);

If scope(exit) also works, then I don't think there is any 
problem...



More information about the Digitalmars-d mailing list