You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This looks fine, top.f has type TOP |> RDQ = TOP by the viewpoint adaptation law and thus can be assigned by a subtype object (the @A Object)
However, if the method is invoked like this, we would lost our type safety.
@BDemoo;
adaptation(o);
In the above code o has type B and o.f has type B as well but in the method invocation, the field is assigned to a type A object which is not a subtype of type B.
This problem could cause serious type safety issues in some type systems, for example, the immutability type system.
We could add a lost qualifier (which was introduced in the Generic Universe Type paper) as the type when the top qualifier looking at a RDQ qualifier. In that case if the variable has type lost, assignment operation is forbidden.
The text was updated successfully, but these errors were encountered:
Imagine a standard lattice like this:
where TOP is the top type in the lattice, BOTTOM is the bottom type in the lattice and RDQ (receiver-dependent-qualifier) is for viewpoint adaptation.
Suppose this type system also supports viewpoint adaptation and a piece of code written like this:
This looks fine, top.f has type
TOP |> RDQ = TOP
by the viewpoint adaptation law and thus can be assigned by a subtype object (the @A Object)However, if the method is invoked like this, we would lost our type safety.
In the above code
o
has typeB
ando.f
has typeB
as well but in the method invocation, the field is assigned to a typeA
object which is not a subtype of typeB
.This problem could cause serious type safety issues in some type systems, for example, the immutability type system.
We could add a lost qualifier (which was introduced in the Generic Universe Type paper) as the type when the top qualifier looking at a RDQ qualifier. In that case if the variable has type lost, assignment operation is forbidden.
The text was updated successfully, but these errors were encountered: