Comment by papln
6 years ago
"can't do" is not the same as "is not a syntactical built-in". Of course Haskell can represent bounded integers:
http://stackoverflow.com/q/7302735
Also, Pascal's ranged integers are only for literals; the are not thoroughly enforced by the compiler. They are trivial to circumvent:
var
y,z: 5..10;
Begin
Read(y); Writeln(y); // 60 works here
y := 10;
z := 2*y; Writeln(z);
https://tio.run/##y0/KSk0u0S1ILE5OzNFNK0j@/z@gKD@9KDFXISU1N9...
No comments yet
Contribute on Hacker News ↗