Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
fields.

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++: http://felix.sf.net