What is Nostr?
yosh /
npub1u86…6gze
2024-08-16 11:17:16

yosh on Nostr: I think I’ve previously stated that I don’t believe Rust’s built-in math ...

I think I’ve previously stated that I don’t believe Rust’s built-in math operators (Div, Add, Mul, etc) should be effectful.

Reading a paper right now where they did *exactly* that (Lutze, Madsen, 2024), and swapping out panics for concrete errors is super useful!:

- division by zero for floats results in NaN, which means Div for floats can be marked as Pure.
- checked integers return concrete errors rather than panic on overflow. This essentially swaps a “panic” effect for a “try” effect.
Author Public Key
npub1u86g6tc80vx4zt5xv6lh5rwammfwgs7envxf9nk02aa5u59cv43shd6gze