Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Width subtyping
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Carette <carette@m...>
Subject: Re: [Caml-list] Width subtyping
Dario Teixeira wrote:
> In other words, polymorphic variants provide a very elegant solution for subtyping
> with sum types.  Is there some brilliant idea that could do the same for product types?
The dual of sums is products.  Open (labelled) sums are "polymorphic 
variants".  Their duals are open (labelled) products are "rows" (which 
O'Caml already supports, through its objects).

See TAPL for a nice introduction to the type theory of labelled records 
with subtyping (i.e. rows).


PS: note that O'Caml's products are positional while its sums are 
labelled, so the duality present in the theory isn't as clear there.  
The better dual for O'Caml's sums is really records.