[Bug 24569] Least common types and lattices


--- Comment #1 from Michael Kay <mike@saxonica.com> ---
I have to confess that I was quite unaware of this mathematical definition of a
lattice, as will be evident to any informed reader of this paragraph!

I'm having trouble reconstructing the thinking that led me to believe that the
lowest common supertype of two types was not unique. Certainly, I'm having
trouble finding a counter-example. I may have simply been assuming that there
was no unique least common supertype on the basis that I could see no proof
that there was.

Perhaps we need to distinguish the set of types that are actually defined in
the in-scope schema definitions from the set of types that the type system
permits to be defined. This only really makes a difference for unions, where we
can easily construct a counter-example if we restrict ourselves to named union
types: if union(A, B, C) and union(A, B, D) both "exist" and union(A, B) does
not "exist", then union(A, B, C) and union(A, B, D) are both common supertypes
of A and B, and neither is the lesser.

But for the purpose of type inference in section 19.2, I don't think we're
constrained to infer a type that is present in the in-scope schema definitions,
so this counter-example isn't pertinent. And I can't think of another (though I
have no idea how to go about proving its absence).

You are receiving this mail because:
You are the QA Contact for the bug.

Received on Friday, 7 February 2014 00:42:00 UTC