A bottom type is a construct primarily appearing in mathematical type theory. It is also called the empty type. It is a type that has no values, but is a subtype of all types.
If a function's return type is the bottom type, that means that it does not return. Period. Maybe it loops forever, or maybe it throws an exception.
What is the point of having this weird type in a programming language? It's not that common, but it is present in some, such as Scala and Lisp.
Aucun commentaire:
Enregistrer un commentaire