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 WAA14286 for caml-red; Sun, 4 Feb 2001 22:05:04 +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 WAA20462 for ; Sat, 3 Feb 2001 22:54:06 +0100 (MET) Received: from fforum.se (dialup-34.abc.se [195.17.73.34]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f13Lrxr16127 for ; Sat, 3 Feb 2001 22:54:05 +0100 (MET) Received: (from mattias@localhost) by fforum.se (8.11.0/8.11.0) id f13LsK116451; Sat, 3 Feb 2001 22:54:20 +0100 Date: Sat, 3 Feb 2001 22:54:20 +0100 Message-Id: <200102032154.f13LsK116451@fforum.se> From: Mattias Waldau To: caml-list@inria.fr Subject: Typing problems when using LablGTK Sender: weis@pauillac.inria.fr The first program works fine, but if I take the let button-part and move it to a separate function called mini, the compilation fails. The type of the method attach is different. What have I misunderstood? /mattias P.s. I learning GNOME using the book "Beginning GTK+/GNOME Programming", and sometimes it is difficult to map GTK in C to LablGTK. I am on page 111. Program 1, works. ================= open GMain let main () = let window = GWindow.window ~border_width:10 ~title:"Fun with tables" ~width:320 ~height:200 () in window#connect#destroy ~callback:Main.quit; let table = GPack.table ~rows:10 ~columns:10 ~packing:window#add () in let button = GButton.button ~label:"test" ~packing:(table#attach ~left:2 ~top:2 ~expand:`BOTH) () in (* mini table; *) window#show (); Main.main () let _ = Printexc.print main () Program 2, fails ================ open GMain let mini table : unit = GButton.button ~label:"mini" ~packing:(table#attach ~left:3 ~top:3 ~expand:`BOTH) (); () let main () = let window = GWindow.window ~border_width:10 ~title:"Fun with tables" ~width:320 ~height:200 () in window#connect#destroy ~callback:Main.quit; let table = GPack.table ~rows:10 ~columns:10 ~packing:window#add () in mini table; window#show (); Main.main () let _ = Printexc.print main () Objective Caml version 3.00+20 (2000-12-03) # Characters 366-371: This expression has type GPack.table = < add : GObj.widget -> unit; as_widget : Gtk.widget Gtk.obj; attach : int -> int -> ?right:int -> ?bottom:int -> ?expand:Gtk.Tags.expand_type -> ?fill:Gtk.Tags.expand_type -> ?shrink:Gtk.Tags.expand_type -> ?xpadding:int -> ?ypadding:int -> GObj.widget -> unit; children : GObj.widget list; coerce : GObj.widget; connect : GContainer.container_signals; destroy : unit -> unit; drag : GObj.drag_ops; focus : GContainer.focus; get_id : int; misc : GObj.misc_ops; remove : GObj.widget -> unit; set_border_width : int -> unit; set_col_spacing : int -> int -> unit; set_col_spacings : int -> unit; set_homogeneous : bool -> unit; set_row_spacing : int -> int -> unit; set_row_spacings : int -> unit > but is here used with type < add : GObj.widget -> unit; as_widget : Gtk.widget Gtk.obj; attach : int -> int -> [> `BOTH] -> GObj.widget -> unit; children : GObj.widget list; coerce : GObj.widget; connect : GContainer.container_signals; destroy : unit -> unit; drag : GObj.drag_ops; focus : GContainer.focus; get_id : int; misc : GObj.misc_ops; remove : GObj.widget -> unit; set_border_width : int -> unit; set_col_spacing : int -> int -> unit; set_col_spacings : int -> unit; set_homogeneous : bool -> unit; set_row_spacing : int -> int -> unit; set_row_spacings : int -> unit > #