Bottom Type--Type Theory

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jan 17 12:40:18 UTC 2019


On Thu, Jan 17, 2019 at 12:02:36PM +0000, Olivier FAURE via Digitalmars-d wrote:
[...]
> Noob question, but wouldn't a top type also be a unit type?

No! A unit type is one inhabited by a single value. A top type is a type
that can represent *every* value.  Very crudely speaking, if types were
numbers, then a unit type is 1, a bottom type is 0, and a top type is
infinity. Or, to use a set analogy, a unit type corresponds with a
singleton set, a bottom type to the empty set (the subtype of every
type), and the top type to the universal set (the supertype of every
type).


T

-- 
Change is inevitable, except from a vending machine.


More information about the Digitalmars-d mailing list