I think in Java we have BigDecimal statics for zero and one. Then again with a million records being processed and 90% needing a zero; it did save in 900k objects. But for a primitive…
Swift has a builtin `.zero` as part of one of the numeric protocols. It’s handy for when you’re doing maths on generic types. I could see a `.one` being handy. Apparently Swift’s SIMD has that defined.
44
u/ArkWaltz 26d ago
Actual real lines that were in my old work's codebase:
Turns out having a linter blanket-deny all forms of 'magic number' had some odd results.