subtyping Questions
2
Solved
I have just read about row polymorphism and how it can be used for extensible records and polymorphic variants.
However, Ocaml uses subtyping for polymorphic variants. Why? Is it more powerful tha...
2
Solved
Reading "Types and programming languages", I got impressed by the object implementation using closures and record subtyping (chapter 18). Is there any particular reason OCaml doesn't support record...
2
Solved
try
{
throw Derived();
}
catch (Base&)
{
std::cout << "subtyping\n";
}
try
{
throw "lol";
}
catch (std::string)
{
std::cout << "coercion\n";
}
Output:
subtyping
terminate ca...
Gallic asked 26/2, 2013 at 20:12
4
Solved
I have started this a new question as it became a follow-on from my previous question.
If I have two data types which are composed of similar constructors:
data A = X | Y | Z
data B = X | Y
is ...
1
Solved
I am confused by the generic subtyping.
In Java, if type A is a subtype of B, generic type C<A> and C<B> are invariant. For instance, ArrayList<Base> is not a subtype of ArrayLi...
© 2022 - 2024 — McMap. All rights reserved.