News for hackers. Stuff that matters.
Re:Push ifs up and fors down by Gadiguibou on Thursday November 16, 2023 @08:50AM (#38289461)
You can also often encode those checks in the type system like in the Option example near the start of the article.
Re:Push ifs up and fors down by RHSeeger on Thursday November 16, 2023 @09:57AM (#38290304)
Assuming your type system is robust enough to support such things. That's not the case for many mainstream languages.
Re:Push ifs up and fors down by sfink on Friday November 17, 2023 @10:08AM (#38304571)
In that case, use DEBUG-only asserts. They're not foolproof (they're only as good as your test suite), but they're pretty damn good.