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...
Disharoon asked 27/5, 2013 at 12:37

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...
Embarrassment asked 6/3, 2013 at 1:56

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 ...
Arvonio asked 9/9, 2012 at 21:38

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...
Holozoic asked 13/5, 2012 at 14:8

© 2022 - 2024 — McMap. All rights reserved.