|
|
|
|
|
by dorfsmay
2914 days ago
|
|
Interesting... I'm a newbie at Rust, and expected y to be a float, because of the division. But it turns out let x = 11;
let y = 11/2;
==> y = 5
Given how type safety is important to Rust, I expected this to panic rather than do an automatic cast. |
|
There would be no type-safety issue or cast if it were implemented as a real division either, incidentally.
There is room to argue Div should not have been implemented at all on integral types (as in Haskell where integer division is a separate operation entirely), but that's a completely different issue.