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

Ben

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners