Two weeks ago, I gave a talk at ACCU based on my paper P0709. The talk video was posted today:
De-fragmenting C++: Making exceptions more affordable and usable [ACCU 2019]
Thanks again to ACCU for inviting me and recording the talk, and for all the fun interactions and conversations with everyone at the conference!
The still image of the video is awesome!
Nice talk. But one reason why I don’t particularly like exceptions is that try and catch require braces (‘{‘ and ‘}’), Unlike if/while/for, where the syntax allows for a single non-compound statement to have no braces, try and catch always require braces, meaning that simple control flow either consumes large numbers of lines (Allman style), or else is hard to read because of the density of braces (K&R style).
So please, if we are to achieve wider adoption of exceptions in place of error codes, allow there to be no braces with try/catch.
Early on, you’re trying to convince us all that we have a problem (which I agree with). In addition to C++ without exceptions is not standard is that RAII without exceptions is impossible.
Ensuring your destructors clean up only gives you RRID. If you’re doing two-step initialization or encumber your objects with zombie states to handle the case where a necessary resource wasn’t available, then you aren’t really allocating your resources on initialization. Yes, two-step initialization (and factories that hide that for you) give you a work around, those classes don’t compose as well as true RAII ones.
This is great work. Please continue.
About the only thing that Rust has on C++ after this is cargo-script, which I’m guessing cling and vcpkg could work for such a thing. There’s currently no coordinator to drive such a project into existence. I guess that’s loading about 3 projects together:
1. A package manager (vcpkg).
2. A universally known build system (CMake).
3. A C++ interpreter (or compile and run quickly) system (cling -run, cl -run, gcc -run).
Combining all of those, you can get to: 4. A way to #! or register a file extension (.ccs maybe?) a single file that can describe its dependencies to the package manager and run as a script of the compiler from the command line or by double-clicking.