Reputation
4,367
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
2 22 39
Newest
 Nice Answer
Impact
~239k people reached

Dec
18
comment What is the conceptual difference between finally and a destructor?
@dan04: Thanks so much, that's the perfect example for this. I could swear I'd come across so many situations where RAII didn't make sense but I had such a hard time thinking of them.
Dec
8
comment What is the conceptual difference between finally and a destructor?
I don't understand, my second example had nothing to do with throwing from a finally, so the fact that you think that's a bad idea should be irrelevant. (By which I mean, even if it never threw, the same argument would apply.)
Dec
8
comment What is the conceptual difference between finally and a destructor?
You never addressed these...
Dec
2
comment What is the conceptual difference between finally and a destructor?
Regarding your other arguments: "Would we really want to log the same thing irregardless?" Yes, it's just an example and you're kind of missing the point, and yes, no one ever prohibited from logging more specific details for each case. The point here is that you certainly can't claim there is never a situation in which you would want to log something that is common to both. Some log entries are generic, some are specific; you want both. And again, you're kind of completely missing the point by focusing on the logging. Motivating 10-line examples is hard; please try to not miss the point.
Dec
2
comment What is the conceptual difference between finally and a destructor?
What are your thoughts on my Javascript example?
Dec
2
comment What is the conceptual difference between finally and a destructor?
@sqykly: I don't understand, why do you say finally is just as wrong as a destructor? What do you think is the right way to achieve that kind of goal? Also, see my second example above. As it shows again, there really doesn't need to be a resource that needs to be released in the finally block.
Dec
2
revised What is the conceptual difference between finally and a destructor?
added 636 characters in body
Dec
2
comment What is the conceptual difference between finally and a destructor?
@BartvanIngenSchenau: Is it that subtle? To me it seems like there's a pretty obvious rule of thumb: if you're releasing a resource, use destructors; otherwise use finally. I feel like that's clear in most if not all cases?
Dec
2
comment What is the conceptual difference between finally and a destructor?
@BartvanIngenSchenau: I never argued that any language currently in existence has a philosophy or implementation that matches what I described. People haven't finished inventing everything that could possibly exist yet. I only argued that there would be value in separating the two notions as they are different ideas and have different use cases. To satisfy your curiosity, I do believe D has both. There are probably other languages too. I don't consider it relevant though, and I couldn't care less why e.g. Java was in favor of finally.
Dec
2
comment Why is there no 'finally' construct in C++?
@StevenBurnap: Hopefully that's not a "true Scotsman" issue? i.e. if a C++ programmer did tell you that, hopefully you wouldn't think less of them as a C++ programmer, right? Because I expect many would, hence why you might never hear that.
Dec
2
comment What is the conceptual difference between finally and a destructor?
@MartinBa: Okay =P let me guess, you're going to argue the first case is too artificial, and that e.g. there must be some kind of "acquire" operation paired with the finally block?
Dec
2
comment What is the conceptual difference between finally and a destructor?
@BartvanIngenSchenau: Is that even a fact? In which language? And why should it factor into this?
Dec
2
answered What is the conceptual difference between finally and a destructor?
Nov
25
comment Is there anything that can be done with recursion that can't be done with loops?
"Prettier" is a technical term...?
Nov
24
answered Is there anything that can be done with recursion that can't be done with loops?
Nov
13
awarded  Nice Question
Nov
3
awarded  Popular Question
Oct
29
comment Why is the minus sign, '-', generally not overloaded in the same way as the plus sign?
This is more likely because set subtraction is defined in math, but set addition is not.
Oct
17
awarded  Popular Question
Aug
20
awarded  Autobiographer