DIP 1017--Add Bottom Type--Final Review

Neia Neutuladh neia at ikeran.org
Fri Jan 18 01:03:59 UTC 2019


On Thu, 17 Jan 2019 23:07:54 +0100, Johannes Loher wrote:
> Am 17.01.19 um 22:59 schrieb Neia Neutuladh:
>> On Thu, 17 Jan 2019 12:15:20 -0800, H. S. Teoh wrote:
>>> A better approach might be to make TBottom* always equal to null --
>>> i.e., it's always illegal to dereference it because no instances of
>>> TBottom can exist.
>> 
>> Dereferencing TBottom* would have to be rewritten as `assert(false);`
>> to make this type of illegal work with generic code.
>> 
> No, dereferencing an instance of type `Tbottom*` is always dereferencing
> `null`, i.e. programm abbortion (which is not the same as `assert(0)`).

Oh, I misread that as "assume that TBottom* is null", sorry. Forcibly 
converting it to null also works. You would have to do that with every 
expression of type TBottom*, not just on cast.


More information about the Digitalmars-d mailing list