jwr1 ( jwr1@kbin.earth ) to Rust@programming.dev · 1 year agoAnnouncing Rust 1.91.0 | Rust Blogblog.rust-lang.orgexternal-linkmessage-square12linkfedilinkarrow-up145
arrow-up145external-linkAnnouncing Rust 1.91.0 | Rust Blogblog.rust-lang.orgjwr1 ( jwr1@kbin.earth ) to Rust@programming.dev · 1 year agomessage-square12linkfedilink
minus-squareFizzyOrange ( FizzyOrange@programming.dev ) linkfedilinkarrow-up3·1 year agoThe non-strict versions also panic by default, but only in debug mode. So if you were willing to use abs() you should be willing to use strict_abs(). Arguably a bit of a mistake to have the “obvious” function names be surprisingly unsafe, but I guess it’s too late to fix that.
minus-squareflying_sheep ( flying_sheep@lemmy.ml ) linkfedilinkarrow-up1·11 months agoI think this is where safety and performance are actually in conflict. I think guaranteeing a panic leads to much worse code gen in this case.
minus-squareFizzyOrange ( FizzyOrange@programming.dev ) linkfedilinkarrow-up1·11 months agoYes that’s true, but the point is you should have to opt in to surprising or risky behaviour.
The non-
strictversions also panic by default, but only in debug mode. So if you were willing to useabs()you should be willing to usestrict_abs().Arguably a bit of a mistake to have the “obvious” function names be surprisingly unsafe, but I guess it’s too late to fix that.
I think this is where safety and performance are actually in conflict.
I think guaranteeing a panic leads to much worse code gen in this case.
Yes that’s true, but the point is you should have to opt in to surprising or risky behaviour.