Change `crate::lir::types::Type::Unit(Name, Ty)` to a better name, like `..::Type::Nominal(..)`
adam-mcdaniel opened this issue · 0 comments
A Unit
type traditionally means the None
type in common nomenclature.
Currently, the Unit
type in Sage is a type that enforces structural equality and nominal equality. A Unit(Meter, Int)
is not equal to an Int
, or a Unit(Kilometer, Int)
; it is only equal to another Unit(Meter, Int)
, where the inner types are structurally equal. An Int
can be cast to a Unit(Meter, Int)
and vice versa. This adds functionality to the type system to typecheck against using a "Meter" where a "Kilometer" is required, even though the data used to represent both the types is the same. It forces the user to perform the unit conversion at the type system level.
I'm thinking a name like Unique
, or Nominal
could be used instead.