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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] OO Interface
From: "Warp" <warplayer@free.fr>

> If I got a parametrized class like :
> 
> class p (x:int) (y:int) =
> object(self)
>     val x = x
>     val y = y
>     method pos = (x,y)
> rnd
> 
> How do I write the correct interface for this class ? I can't figure out how
> to specify the parameters type.

Here is the interface, as the typechecker tells you,
class p :
  int -> int -> object method pos : int * int val x : int val y : int end

You can directly write it in the .mli.

Or did you mean class type?
Actually, this automatically defines the following class type,
class type p =
  object method pos : int * int val x : int val y : int end

Hope this helps,

Jacques Garrigue
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr