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
[Caml-list] does class polymorphism need to be so complicated?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Benjamin Geer <ben@s...>
Subject: Re: [Caml-list] does class polymorphism need to be so complicated?
Jacques Garrigue wrote:
> Because #connection is _not_ an interface. It is just a polymorphic
> type including all types having more methods than connection.
> So returning a #connection means that the returned object already has
> all the methods in the world, with all types imaginable. Nonsense.
> #connection only makes sense on the left-hand side of an arrow.

Thanks for this explanation.  It shows very clearly the advantage of 
using the approach involving coercions: with coercions, a method can 
return an instance of the base class, so factory methods become possible.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: