On Tue, Jul 22, 2025 at 3:48 PM Sebastian Wittmeier via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

 

It does, what it should. Is it short? Is it pretty? Not sure.


Scopes work in a lot of cases. However, the ideal solution might be overlapping scopes in some cases.

I want to bring back an idea from Rust: It has a drop() function which will call the destructor of an object immediately (and thus officially ends the lifetime of an object). It better states the goal of ending the lifetime explicitly than nested scopes.

I would say that drop() is longer than scopes (at least number of keystrokes), but it is one less line to read. Maybe it is not short, but it is concise. And I would claim it is much prettier than scopes.