Re: The Case for Rust (in any system)
- In reply to: Alan Somers : "Re: The Case for Rust (in any system)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Sep 2024 08:12:51 UTC
Hi Alan, On 9/12/24 14:52, Alan Somers wrote: > Thank you! This is some of the best criticism I've seen so far. Thanks! > No doubt Yuri already knows the following, but I'll explain it for > other readers' sake. I too have used to use exceptions in C++, Java, > Python, and Ruby. The problem with exceptions is that you can never > know what errors your function might have to deal with. You can add > error handling for every exception type that you know about, but > there's nothing to prevent some lower-level library function from > throwing an entirely new exception that you've never heard of. When > that happens, your program will crash with "uncaught exception". The > problem is worst in Python, but it affects C++, too. C++'s solution to > that problem was checked exceptions. A function would document in its > signature all of the exception types that it might throw, and the > compilation will fail if the code attempts to throw any new ones. That > way, consumers could be confident that they could handle all possible > errors. The problem with this approach is that lower-level libraries > frequently added new exception types, with the result that their > consumers' builds would frequently fail. That's why C++11 deprecated > checked exceptions. Unknown exception types are actually not a problem in practice, as long as all exception types inherit from std::exception. Then you just catch that type as a fallback for all known exception types. > Like Yuri I've used Ratatui in Rust. But unlike Yuri I haven't > written any TUIs in C or C++. For my education, could you point me to > some examples? Something that FTXUI is particularly good at? There are several FTXUI based projects among ports: misc/json-tui, devel/git-tui, misc/rgb-tui. Many other examples are listed here: https://github.com/ArthurSonzogni/FTXUI?tab=readme-ov-file#project-using-ftxui Cheers, Yuri