DIP 1017--Add Bottom Type--Final Review

Johannes Loher johannesloher at fg4f.de
Thu Jan 17 22:52:02 UTC 2019


Am 17.01.19 um 23:33 schrieb H. S. Teoh:
> I'm not so sure about that.  A true Unit type conveys no information,
> yet TBottom* conveys at least this information: that it's a pointer, and
> that the pointer cannot be dereferenced.  A true Unit type would be the
> return type of a void function; would you equate TBottom* with the
> return type of a void function?  That would be very strange indeed.

I suggested this earlier in this thread, i.e.

```
alias void = Tbottom*;
```

This would make `null` the single value `void`.

If we were to follow type theory rigorously, we would not even have
another choice than doing this because all types which have exactly one
value are naturally isomorphic and this means they are equal from a type
theory perspective.

This is not the case in D (in particular while struct A {} and struct B
{} are of the same type from a rigorous type theory perspective, they
are not in D). So we don't actually have to do it like this, but it
would be an option (if we fixed void to be a proper unit type).



More information about the Digitalmars-d mailing list