On 09/02/2018 12:21 AM, Jonathan M Davis wrote:
The C APIs on the other hand require that you check the return value, and some of the C++ APIs require the same.
Heh, yea, as horrifically awful as return value errors really are, I have to admit, with them, at least it's actually *possible* to handle these low-resource situations sanely, instead of D's "not-so-right-thing by default" approach of *guaranteeing* that all software under the same circumstance just freaks out and runs screaming like KDE.
(Much as I love D, and as much as I believe in "fail fast", the "Error" class still irritates me to no end. My usual approach to dealing with it is to stick my fingers in my ears and go "La la la la la!!! It doesn't affect me!!! There's no such thing as non-Exceptions being thrown!!! La la la!!!!". Not exactly a sound engineering principle. If we actually HAD the mechanisms Walter advocates for *dealing* with fail-fast processes, then I might have a different opinion. But we *don't*, it's just code-n-pray for now, and nothing of the sort is even on the most pie-in-the-sky roadmap.)
Honestly, for some of this stuff, I think that the only way that it's ever going to work sanely is if extreme failure conditions result in Errors or Exceptions being thrown, and the program being killed.
Under current tools and approaches, that is, unfortunately, probably very true.
However...
Most code simply isn't ever going to be written to handle such situations,
This is 2018. We all have a freaking Dick Tracy wireless supercomputer, that can believably simulate entire connected alternate realities, in realtime...in our pockets! Right now!
If we, the collective software development community of 2018, can't get far enough off our collective asses and *do something about* (as opposed to *completely ignore and never bother even so much as an automated test*) something as basic, obvious, *automatable*, and downright *timeless* as...not having our software freak out in the absence of resources we're not even freaking using...Well, then we, as an entire profession...genuinely SU*K. Hard. (And yes, I am definitely including myself in that judgement. I'm more than willing to change my prehistoric-programmer ways. But implementation-wise there's relevant domain experience I lack, so I can't make this all happen by myself, so there needs to be some buy-in.)
Anything C-based (and plenty of C++-based programs too) is going to have serious problems though
Well, yea. No mystery or surprise there. Another reason I tend to be a bit dismayed at the continued popularity of those languages (not that I'm unaware of all the reasons for their continued popularity).