News for hackers. Stuff that matters.
Re:The C3 Programming Language by coldtea on Saturday January 03, 2026 @03:16PM (#46481067)
>The way I reason about it is that the contracts are more soft conditions that you expect to not really reach

What's the difference from an assert then?

Re:The C3 Programming Language by lerno on Saturday January 03, 2026 @04:11PM (#46481613)
The difference from an assert is that for "require" they are compiled into the caller frame, so things like stack traces (which is available in safe mode) will point exactly to where the violation happened.

Because of inlining them at the call site happens, static analysis will already pick up some obvious violations.

Finally, these contracts may be used to compile time check otherwise untyped arguments to macros.