3 ms·
> such as ensuring an integer is in a particular range I find it funny that one of the most advanced programming languages of our day can't do what Pascal did
by oblio 7y ago
> such as ensuring an integer is in a particular range
I find it funny that one of the most advanced programming languages of our day can't do what Pascal did back in 1980 :-)
- papln 7y 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 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@aS0GhLLEISAJBpU6VlYKpnp6hgTUXl1NqemYeUBAkFZSamKJRqWkNZIYXZZak5uRBePr6WgpmBgpa@iBFlQpWtgogrUB2FYhtpFUJ5sC0VGlac7nmpej9/29mwAUA https://tio.run/##y0/KSk0u0S1ILE5OzNFNK0j@/z@gKD@9KDFXISU1N9...