DIP 1017--Add Bottom Type--Final Review
Johan Engelen
j at j.nl
Wed Jan 16 11:23:18 UTC 2019
On Wednesday, 16 January 2019 at 04:20:42 UTC, aliak wrote:
> On Tuesday, 15 January 2019 at 22:44:56 UTC, Johan Engelen
> wrote:
>> The link does not really have answers that explain the use of
>> a bottom type in a practical imperative language, beyond that
>> it signifies `noreturn`.
>> The question we have is whether there is a compelling use for
>> "bottom". I'd like to see a real code use case, besides
>> signifying `noreturn` (trivial).
>
> A very practical use case is with error code paths where you
> end up asserting/exiting the program, something like:
>
> int f(int i) {
> if (i) {
> exit(0);
> } else {
> return 0;
> }
> }
This is just another example of using the bottom type to signify
`noreturn`, which is trivially done with an attribute and doesn't
need a new type. I'd like to see _other_ practical uses of the
bottom type.
-Johan
More information about the Digitalmars-d
mailing list