faster-cpython / ideas

1.68k stars 48 forks source link

Swap top/bottom of partial order #658

Closed gvanrossum closed 7 months ago

gvanrossum commented 7 months ago

After consulting Wikipedia, we realized that the Top of a subtype relationship is the universal type (e.g. object in pure Python) while the Bottom is the uninhabited type (e.g. Never).

I swapped the chart representing the possible types. I also rewrote the following text to use the term partial order instead of lattice -- using "lattice" to discuss the subtype relationship seems confusing, while using "partial order" feels helpful.

I kept the term "lattice" for the diagram of the state we record about a set of variables though, because in that context thinking about it as a lattice seems helpful. I kept Top and Bottom as they were there -- though honestly I'm not sure that's right either. It seems the state where we know nothing about any variable might be called either Bottom or Top depending on which way you define the ordering. The state where we have a specific type assigned to each variable, however, is not unique, and I'm not sure it should be called either Top or Bottom. @Fidget-Spinner, thoughts?