Add functions for comparing and canonicalizing global names.
Let a reduced name contain a type at the end.
Make global name comparison not care which name is shorter.