🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++
Article #1008

Re: A better experimental::scope_exit

#1008
From: David Brown
Date: Mon, 23 Nov 2026 15:45
47 lines
3612 bytes
On 23/11/2026 15:33, Bonita Montero wrote:
> Am 23.11.2026 um 15:19 schrieb David Brown:
> 
>> That is not an example - it's a vague idea of an imagined use-case.
> 
> Ususally I don't cascade. But I had this usecase multiple times when
> applying several changes on a data structure where each operation
> could fail with an exception.
> 
>> Try  showing an example, using your scope_exit.
> 
> Can't you imagine the purpose from the code - poor !
> 
>> Compare it with  alternatives. ...
> 
> experimental::scope_exit hasn't cascading and no explicit run().
> 
>> Then we will be able to see if and why your code is  better,
>> and also get an idea whether it would be better to have it in addition 
>> to normal scope_exit features, rather than
>> instead of them.
> 
> You really have a lack of imagination.
> Or you don't understand the code.

Programming is not just a matter of churning out lines of code.

Claiming things are "obvious" or that others "lack imagination" is an 
excuse for being unable or unwilling to explain your own thoughts.  If 
you have trouble explaining things, then the suggestions below will 
help.  If you are simply unwilling to do so, then why bother posting the 
code in the first place?  It is unusable to others as it is, and 
contains nothing particularly innovative.  If you are posting it so that 
we can discuss it, then that's great - so discuss it.  If not, then why 
did you post it?

Figure out what you want to achieve.  Figure out how the code should be 
used.  Specify it, describe it, document it.  Show examples.  Compare it 
to existing solutions.  Show why your "defer" class with "Dependent" 
pointers is necessary, and better than a single "standard" scope_exit 
function that does more than one thing, or multiple "standard" 
scope_exit calls.  Explain why it is so common to need theses 
"Dependent" variables that they should be included in a general "defer" 
class, rather than a specialised version used occasionally.  Explain why 
a single "Dependent" is enough, rather than accepting multiple 
"Dependents".  Explain what you mean by "Dependent" in the first place.
Technical Details
Message-ID: <11e1n3c$20kso$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11dsk17$8ske$2@raubtier-asyl.eternal-september.org> <11e1bd7$1rqma$1@dont-email.me> <11e1gtl$1u1jq$1@raubtier-asyl.eternal-september.org> <11e1i1q$1ugou$1@dont-email.me> <11e1is8$1ur7r$1@raubtier-asyl.eternal-september.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c++
Subject: Re: A better experimental::scope_exit
Date: Mon, 23 Nov 2026 16:45:47 +0100
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <11e1n3c$20kso$1@dont-email.me>
References: <11dsk17$8ske$2@raubtier-asyl.eternal-september.org>
 <11e1bd7$1rqma$1@dont-email.me>
 <11e1gtl$1u1jq$1@raubtier-asyl.eternal-september.org>
 <11e1i1q$1ugou$1@dont-email.me>
 <11e1is8$1ur7r$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 23 Nov 2026 15:45:48 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2118552"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18yGDqNxLL9+jsVhstBMN0ogefnDMYmnzQ="; posting-host="4c393d4ea759cbe76e4062837f9f8a62"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:T2/e6yumlf2jLJShgptSPZ6yo4w= sha256:EZ62UqzboEgyDUSCgdaT463JqPbCdXUvCcNa3yM2cqY=
	sha1:uMzAJnXamcWpyI1p8gMlxNgiu+Y= sha256:aypbdHrDy/kSXin0C7nY1Q7SKAWBwI00jiHJCTFgcxk=
Content-Language: en-GB, nb-NO
In-Reply-To: <11e1is8$1ur7r$1@raubtier-asyl.eternal-september.org>