Today,std.debug.assert is already clear and explicit. Its behavior is well defined, and its implementation is simple and correct. I don’t want to argue about that, this is true and you are right, but I personally think that assertions are important, and deserve to be upgraded for several reasons.
Zig already has many builtins whose main purpose is consistency rather than convenience. Builtins like exact division, overflow-aware arithmetic, or power-of-two related operations exist because they express intent directly to the compiler and allow consistent lowering to the right instructions when the platform supports it. They sit at the boundary between what the programmer means and how the code is lowered. Assertions naturally belong in that same category, in my opinion.
std.math.divExact(comptime T: type, numerator: T, denominator: T)
@divExact(numerator: T, denominator: T)
std.math.log2(x: anytype)
@log2(value: anytype)
std.debug.assert(ok: bool)
@assert(ok : bool) // makes sense :)
Assertions encode invariants. Those invariants are used by humans reading the code, and usefull for the optimizer as well. A builtin makes this intent visible earlier and more reliably than a library function, without depending on inlining or optimization heuristics. The goal is not micro optimization, but rather consistency and confidence in the lowering.
Some real-world projects have ended up reimplementing their own assertion helpers to get more predictable behavior in hot paths or across build modes. That does not mean std.debug.assert is wrong, it just shows that assertions are important enough that people want stronger guarantees than what a regular function can provide, which again seems like what builtins really do at the end of the day. Especially because it would also reduce fragmentation, if each library has a different assert semantic, that’s not great for code reuse.
Tooling is another strong reason. Zig has a long-term plan to implement a compiler server protocol (or something like that i don’t remember) that other tools can build on top of. In that context, assertions are not just function calls, they are semantic facts. If assertions are a builtin, I assume it would be easier for external tools, to build upon those assertions, even the compiler could potentially leverage that.
In short, std.debug.assert is already good, but it could be improved by making assert a first-class, builtin feature. Doing so would make assertions more useful, more visible to the compiler and tools, and more consistent with other Zig builtins that exist specifically to express intent and ensure correct lowering.
Also I really like builtins, and how they stand out, and it’s simpler to type @assert (but i know those aren’t good reason ahah)
I could also see an argument for splitting assert into 2 builtins, with @assert() and @assume() and you could get the same behavior with @assume(@assert())