On Friday, 25 November 2022 at 08:12:41 UTC, Dukc wrote:
>What does "best-effort" mean?
Generally, it means that a procedure is not a complete or ideal solution and won’t always give you what you need (even if it theoretically could), but still covers common and simple cases and maybe some of the uncommon or complicated ones. Usually, best-effort solutions are subject to incremental improvements.
A simple example for best effort is compiler error messages: Usually, they’re pointing you to the spot where you change something and it works. Sometimes, the error is nowhere the error message indicates.
Another example well-known to many D programmers that is both, best-effort and ideal, is @safe
. It intends to be a complete (or ideal) solution in the sense that when checking for @safe
succeeds, the code has no UB (give or take @trusted
, of course). A compiler that accepts UB in @safe
code has a bug!
On the other hand, @safe
is best-effort in the sense that it does not even intend to cover all non-UB code. There will always be (rather simple) code for which you can (rather easily) prove that it is indeed free of UB, but the compiler’s @safe
checks reject it. The language development goes into the direction of recognizing more and more of non-UB code as @safe
(DIP 1000 most notably), but it will never be able to cover the entirety of non-UB because that would equate to solving the halting problem, which is provably impossible. Because it ideally would be, but mathematically can’t, and even in cases where there is a proof showing no UB, it’s not intended the compiler finds it, because practically, it’s not worth it, it is a best-effort solution.
I don’t think “best-effort” is used here with any more special meaning.