Version française
Home     About     Download     Resources     Contact us    
Browse thread
class and printf
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@i...>
Subject: Re: [Caml-list] class and printf
On 10/30/06, Anastasia Gornostaeva <ermine@ermine.pp.ru> wrote:
> Hello.
>
> What I need to drink to compile it?
>
> class foo ch =
> object
>  method myprintf = Printf.fprintf ch
> end
>
> The compiler says
> The method myprintf has type ('a, out_channel, unit) format -> 'a where 'a
> is unbound
>

This one works:

class ['a] foo ch =
object
 method myprintf (fmt : ('a, out_channel, unit) format) =
   Printf.fprintf ch fmt
end

-- 
Nicolas Pouillard