Change crate::lir::types::Type::Unit(Name, Ty)
to a better name, like ..::Type::Nominal(..)
#38
Labels
crate::lir::types::Type::Unit(Name, Ty)
to a better name, like ..::Type::Nominal(..)
#38
A
Unit
type traditionally means theNone
type in common nomenclature.Currently, the
Unit
type in Sage is a type that enforces structural equality and nominal equality. AUnit(Meter, Int)
is not equal to anInt
, or aUnit(Kilometer, Int)
; it is only equal to anotherUnit(Meter, Int)
, where the inner types are structurally equal. AnInt
can be cast to aUnit(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
, orNominal
could be used instead.The text was updated successfully, but these errors were encountered: