4 ms·
> the madness of a function called `getchar` returning anything but a `char` It’s effectively returning a Maybe(char).
by chrisseaton 7y ago
> the madness of a function called `getchar` returning anything but a `char`
It’s effectively returning a Maybe(char).
- nixpulvis 7y agoBut it's not. A `Maybe<char>` has exactly one `None` variant. While an `int` has many, many negative values. Also, just calling it `None` (or similar) makes clear what is meant, while `-1` is some magic value.
- chrisseaton 7y ago> while `-1` is some magic value It's a documented return value. Nothing magic about it.