Bottom Type--Type Theory

Neia Neutuladh neia at ikeran.org
Wed Jan 16 23:24:24 UTC 2019


On Wed, 16 Jan 2019 14:32:33 -0800, Walter Bright wrote:
> * top type (represents every value, like D's "Object" root type)

D doesn't have a top type. Object is the top of the hierarchy of non-COM, 
non-C++ classes. std.variant.Variant is the closest thing D has to a top 
type.

> An example of an awkward corner case caused by lack of a bottom type:
> 
>     @noreturn int betty();
> 
> How can it return an int yet not return? It makes no sense.

Any empty type would suffice here. Bottom is just one canonical empty type.

> My trouble explaining the immediate value of a bottom type stems from my
> poor knowledge of type theory. Other languages aren't necessarily good
> role models here, as few language designers seem to know much about type
> calculus, either. I was hoping that someone who does understand it would
> help out!

I'm sorry that I missed your post asking for help on this DIP's background 
research while it was being drafted.

> (I.e. it's not just about functions that don't return. That's just an
> obvious benefit.)

This seems like a very good way to get the details wrong and eliminate the 
potential benefits that a different implementation, one better informed by 
theory or real-world examples from other programming languages, could give.


More information about the Digitalmars-d mailing list