Skip to main content

Questions tagged [never-type]

For questions about a 'never' type, the type of an expression that is never reached or evaluated. This would typically be used as the return type for functions that never return, such as those that terminate the program, or that designate an unreachable point in a program.

Filter by
Sorted by
Tagged with
13 votes
7 answers

Are there any situations in which it would make sense to return a never type?

Some languages (Rust is the first one that comes to mind) have a "never" type. This is represented in Rust as !, and represents a function that never ...
Ginger's user avatar
  • 2,629
3 votes
3 answers

Why do some languages not have an 'unreachable' function?

Several languages have a function or macro to indicate that a certain point in control flow cannot be reached, even though the compiler cannot statically prove it, such as ...
Bbrk24's user avatar
  • 9,067
21 votes
9 answers

Are there disadvantages of including a never type?

A never type represents an expression that is never evaluated or the type of an expression that represents an unreachable point in a program. The return value of an ...
CPlus's user avatar
  • 8,321