Bottom Type--Type Theory

Neia Neutuladh neia at ikeran.org
Fri Jan 18 01:00:35 UTC 2019


On Thu, 17 Jan 2019 14:21:45 -0800, H. S. Teoh wrote:
> If instead we allow the declaration of `Bottom var;`, with the
> stipulation that it corresponds with the runtime code for halting the
> program (e.g., assert(0)), then the implementor of func wouldn't even
> have to think about the possibility of T == Bottom.  When the user
> passes Bottom to func, the function naturally just aborts where var is
> declared.

This is also an asymmetry: the following two functions abort at different 
places only when passed TBottom. In fact, they only abort when passed 
TBottom.

void foo1(T)()
{
  writeln("line 1");
  T value = void;
  writeln("line 2");
}
void foo2(T)()
{
  T value = void;
  writeln("line 1");
  writeln("line 2");
}


More information about the Digitalmars-d mailing list