1,656 karma · joined Mar 24, 2014 (12y ago) · 1,717 submissions
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
In other words, 10 pages of LLM blather isn’t doing much to convince me a given answer is actually better.
comment 1y ago · link · parent
comment 1y ago · link · parent
If you want to simplify the callsite, just move the exception handling to a higher scope. I can admit it’s a little irritating to put a try/catch in main but it’s trivial to automate, and most programs are not written inline in main.
The main problems I see with destructors have to do with hidden control flow and hidden type information. That said, hiding exceptional control flow from the mainline control flow of a function is also a useful feature, and the “exception type” of any given function is the recursive sum of all the exception types of any functions or operators it calls, including for example allocation. That quickly becomes either an extremely large and awkward flat sum or an extremely large and awkward nested sum, with awkward cross-namespace inclusion, and it becomes part of the hard contract of your API. This means, transitively, that if any deep inner call needs to extend or break its error types, it must either propagate all the way up into all of your callers, or you must recover and merge that error into _your_ API.
For _most_ usecases, it is just simpler to implement a lean common interface such as std::exception and allow callers who care to look for more detailed information that you document. That said, there is a proposal (P3166 by Lewis Baker) for allowing functions to specify their exception set, including via deduction (auto):
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p31...
comment 1y ago · link · parent
At some point, people saw the cool-looking stickered-up laptops and thought they would also look cool and put fun stickers on their laptops to show that they also can google things. This diluted the original social signal value until it was completely ubiquitous, kind of like if everyone started putting whatever patches appeal to them on whatever jacket they wear without any thought to the idea of their origin. By that time, the original sticker-signalers had all moved on to other signals.