Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Five Questions about Objects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Oleg <oleg_inconnu@m...>
Subject: Re: [Caml-list] Five Questions about Objects
On Sunday 14 July 2002 11:47 am, Xavier Leroy wrote:
> > 4) Can I construct an object that the following function f would accept?
> > # let f a = a#m1 (); a#b#m2 ();;
> > val f : < b : < m2 : unit -> 'a; .. >; m1 : unit -> 'b; .. > -> 'a =
> > <fun> 

[...]

> As for your example, just read the type of f aloud: the argument to f
> should be an object having at least an "m1" method and a "b" method;
> "b" should return an object having at least an "m2" method.

To me, " b : < m2 : unit -> 'a; ...>" seems to mean the following: "b" IS an 
object having at least "m2" method of type "unit -> 'a". Just like m1 is 
"m1 : unit -> 'b" above, not "m1 : 'b".

Had the toplevel said 
val f : < b : unit -> < m2 : unit -> 'a; .. >; m1 : unit -> 'b; .. > -> 'a 
It would have meant the same thing to me as it does to you in its present 
reading.

Regards,
Oleg
-------------------
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