From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA06751 for caml-red; Mon, 5 Feb 2001 17:55:49 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA10689 for ; Mon, 5 Feb 2001 00:12:30 +0100 (MET) Received: from postfix2-1.free.fr (postfix2-1.free.fr [213.228.0.9]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f14NCT903370 for ; Mon, 5 Feb 2001 00:12:29 +0100 (MET) Received: from sbuilders.com (paris11-nas8-54-198.dial.proxad.net [212.27.54.198]) by postfix2-1.free.fr (Postfix) with ESMTP id 672B3C179; Mon, 5 Feb 2001 00:12:28 +0100 (CET) Message-ID: <3A7DE13C.B1CFC6AD@sbuilders.com> Date: Mon, 05 Feb 2001 00:09:48 +0100 From: Maxence Reply-To: max@sbuilders.com X-Mailer: Mozilla 4.75 [fr] (X11; U; Linux 2.2.16-22 i686) X-Accept-Language: fr, en MIME-Version: 1.0 To: Mattias Waldau Cc: caml list Subject: Re: Typing problems when using LablGTK References: <200102032154.f13LsK116451@fforum.se> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis@pauillac.inria.fr Just add explicit type for the table parameter of your mini function : let mini (table : GPack.table) : unit = GButton.button ~label:"mini" ~packing:(table#attach ~left:3 ~top:3 ~expand:`BOTH) (); () > What have I misunderstood? I think you didn't misunderstood anything. I was surprised too, the first time :-) take a look at the example below : class context () = object method get_string ?(default="great!") message = (* this function could display a message and an entry widget to make the user type in some text. The entry would contain the default text when the window appears. for the example, we just return the default text.*) print_string message; default end let f ctx = ctx#get_string "how do you feel ?" let ctx = new context () let feeling = f (ctx :> string>) ocaml complains about the coercion of ctx : This expression cannot be coerced to type < get_string : string -> string >; it has type context = < get_string : ?default:string -> string -> string > but is here used with type < get_string : string -> string > The question is : why is this coercion not allowed ? Maxence Guesdon