Bottom Type--Type Theory

Johannes Loher johannesloher at fg4f.de
Fri Jan 18 00:13:28 UTC 2019


Am 18.01.19 um 00:53 schrieb H. S. Teoh:
> Another case to consider: what should .typeid of Tbottom return?
> 
Indeed an interesting question. Since `Tbottom` is a type like any
other, it needs to return an instance of TypeInfo.

The even more interesting question is what the methods should return.
Take for example `TypeInfo.equals`. Because there are no values of type
`Tbottom`, any two instances of type `Tbottom` are equal and the method
should return true. On the other hand, by the same argument, any two
instances of `Tbottom` are not equal and the method should return false.
>From a more pragmatic point of view: It does not really matter what this
method returns. It does take pointers to void which internally will be
cast to `Tbottom*` (becasue we are actually comparing `Tbottom`s) and
then dereferencing it will simply abort the program (`null` dereferencing).

I think it is similar for the other methods. Some simply return some
information about the type, e.g. `talign` should return 0.


More information about the Digitalmars-d mailing list