Open plt-amy opened 5 years ago
I think the "empty type" is a good approximation but it might actually be a red herring. What we want is support for eliminating tails of bottoming computations generally (Amulet exceptions, compiler-generated error
calls, infinite recursion, empty matches, "returning" an empty type, etc..), which is bloody hard to do in a well-typed way.
According to Amulet's semantics, the following is a valid optimisation:
This is mostly a code size/compiler performance optimisation: the following program would get DCE'd to all but the call to
bot
, whereas currently it includes all of the IO/Exception machinery:After we have attributes, we could even mark functions as returning bottom, which would let us optimise uses of
(import "amulet/exception.ml").throw
.