The documentation of Language::discriminant says the following:
Type representing the cases of this language.
Used for short-circuiting the search for equivalent nodes.
Return the Discriminant of this node.
What properties must this discriminant uphold?
From a quick look at the code, I am inferring that it must:
- Be compatible with
Language::matches: if a.matches(b) then a.discriminant() == b.discriminant() (and not necessarily the reciprocal)
- Be compatible with
Ord: if a.discriminant() == c.discriminant() && a < b && b < c then a.discriminant() == b.discriminant()
Are there other requirements?
The documentation of
Language::discriminantsays the following:What properties must this discriminant uphold?
From a quick look at the code, I am inferring that it must:
Language::matches: ifa.matches(b)thena.discriminant() == b.discriminant()(and not necessarily the reciprocal)Ord: ifa.discriminant() == c.discriminant() && a < b && b < cthena.discriminant() == b.discriminant()Are there other requirements?