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
Smells like duck-typing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-10-18 (16:22)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Smells like duck-typing

On Thu, 2007-10-18 at 10:45 -0400, Brian Hurt wrote:

> I will note that Ocaml's row-level polymorphism allows you to invent new 
> supertypes of a given subtype as needed (a real nice feature, IMHO).  
> But what he's asking for is fundamentally nonsensical.

No it isn't, its just mis-stated. What he actually wants is projections,
which are perfectly sound. That is, given a concrete record with N
fields, a collection of *views* which only expose a subset of the

More generally, not just a subset of fields, but a new record
which is the image of a epimorphism (a structure preserving
surjection or 'onto' mapping).

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: