Closed shenlebantongying closed 2 months ago
As of right now in steel, 1/0 will panic!
1/0
panic!
λ > 1/0
In racket, 1/0 is a syntax error.
The panic appears to be in the num package.
I think here should throw a bad syntax error like in racket too, instead of letting num to panic.
https://github.com/mattwparas/steel/blob/d81f428767ad8872beaf628791b7351df320b147/crates/steel-core/src/compiler/program.rs#L43
https://github.com/rust-num/num-rational/blob/e580ced0602ae8a5e06a8dea8623d70be8c5f3bc/src/lib.rs#L129-L135
Note that in racket, (/ 1 0) is a runtime error while (/ 1 0.0) is inf.
(/ 1 0)
(/ 1 0.0)
inf
In steel, both (/ 1 0) and (/ 1 0.0) is inf.
Thanks for the report! I've thrown up #193 to address this. Going to add some more tests before I merge but otherwise I think that will address it.
Nice
As of right now in steel,
1/0
willpanic!
In racket,
1/0
is a syntax error.The panic appears to be in the num package.
I think here should throw a bad syntax error like in racket too, instead of letting num to panic.
https://github.com/mattwparas/steel/blob/d81f428767ad8872beaf628791b7351df320b147/crates/steel-core/src/compiler/program.rs#L43
https://github.com/rust-num/num-rational/blob/e580ced0602ae8a5e06a8dea8623d70be8c5f3bc/src/lib.rs#L129-L135
Note that in racket,
(/ 1 0)
is a runtime error while(/ 1 0.0)
isinf
.In steel, both
(/ 1 0)
and(/ 1 0.0)
is inf.