My comment was taken out of context, and I feel like this reply is being made to my comment in isolation. I was not making an argument that the semantics of unreachable or the std.debug.assert function should change or that they’re hard to understand. My argument is that writing in this style:
const bar_result = bar();
foo(bar_result);
Has entirely obvious behavior, even when foo(...) may be a no-op due to comptime conditions like the build safety mode.
When foo(...) is a no-op due to the build mode, it is not immediately obvious what the behavior of
foo(bar());
is. As is evident by the existence of the original question in the other thread, asking if bar() (in this case) would be evaluated. It is not a difficult problem to reason about, but the first style in this comment would not have raised the question, and the second style prompted me to take a few seconds to reason through it.
I don’t honestly care all that much; I think it’s fine to have code written in the style of the second way in the standard library. I would prefer to write code in the first style though, where the behavior just seems unquestionably obvious.