Re:Bottom Type in F#
by aliceryhl on Wednesday September 23, 2020 @05:29AM
(#24564883)
No because the type bottom has no valid values, whereas null as one valid value, namely null. A function that returns bottom must loop forever, because there are no values that it would be valid for the function to return.
[ Parent
| on HN ]
Loop forever, or, more commonly in actual use cases, terminate via a nonlocal return (eg. exceptions, `longjmp`, `abort`).
As an aside, in any programming language that does not support/enforce total functions, the return type `T` of any function is actually the sum type `T | Bottom`, which is to say, "this function either returns a value of type `T` or never returns to its caller at all!"
Also used as the type of expressions that do not return a value (things like `break`, `continue`, or `throw` in expression-oriented languages).