From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 49FEA7ED34 for ; Mon, 16 Jul 2012 08:49:55 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of ivg@ieee.org) identity=pra; client-ip=95.108.253.141; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="lisp-hacker@yandex.ru"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of lisp-hacker@yandex.ru designates 95.108.253.141 as permitted sender) identity=mailfrom; client-ip=95.108.253.141; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="lisp-hacker@yandex.ru"; x-sender="lisp-hacker@yandex.ru"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@forward16.mail.yandex.net) identity=helo; client-ip=95.108.253.141; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="lisp-hacker@yandex.ru"; x-sender="postmaster@forward16.mail.yandex.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmcCALC4A1BfbP2NnGdsb2JhbABFigiuMyIBAQEBAQgLCQkUJ4JOghCIJJomoDiSBwOIRYUih1SBEpFY X-IronPort-AV: E=Sophos;i="4.77,592,1336341600"; d="scan'208";a="166959990" Received: from forward16.mail.yandex.net ([95.108.253.141]) by mail1-smtp-roc.national.inria.fr with ESMTP; 16 Jul 2012 08:49:53 +0200 Received: from web21g.yandex.ru (web21g.yandex.ru [95.108.253.230]) by forward16.mail.yandex.net (Yandex) with ESMTP id 34627D21480 for ; Mon, 16 Jul 2012 10:49:52 +0400 (MSK) Received: from 127.0.0.1 (localhost.localdomain [127.0.0.1]) by web21g.yandex.ru (Yandex) with ESMTP id 0C57A7E0057; Mon, 16 Jul 2012 10:49:51 +0400 (MSK) Received: from wimax-client.yota.ru (wimax-client.yota.ru [178.176.109.231]) by web21g.yandex.ru with HTTP; Mon, 16 Jul 2012 10:49:51 +0400 From: Ivan Envelope-From: lisp-hacker@yandex.ru To: "caml-list@inria.fr" MIME-Version: 1.0 Message-Id: <678391342421391@web21g.yandex.ru> Date: Mon, 16 Jul 2012 10:49:51 +0400 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain Subject: [Caml-list] passing object to a function fails to compile (lablgtk2 involved) Excuse me for the topic formulation, but I cannot state it better. I have two simple functions: let fill_model model name_col value_col = let pars = P.from_file "parallax.cfg" in let add_record (name, value) = let iter = model#append () in model#set ~row:iter ~column:name_col name; model#set ~row:iter ~column:value_col value in List.iter add_record pars (where P.from_file some function generating an assoc list -> (string * string) list ) and let create_model () = let cols = new GTree.column_list in let name_col = cols#add Gobject.Data.string and value_col = cols#add Gobject.Data.string in let model = GTree.list_store cols in (model, name_col, value_col) When I try to pass values returned by function `create_model' to function `fill_model' with the following expression: let model, name_col, value_col = create_model () in fill_model model name_col value_col compiler refuses with: Error: This expression has type GTree.list_store but an expression was expected of type < append : unit -> Gtk.tree_iter; set : row:Gtk.tree_iter -> column:'a -> Types.id -> unit; .. > The universal variable 'b would escape its scope If I write the two functions in one, like this: let fill_and_create_model () = let cols = new GTree.column_list in let name_col = cols#add Gobject.Data.string and value_col = cols#add Gobject.Data.string in let model = GTree.list_store cols in let pars = P.resolve_links (P.from_file "parallax.cfg") in let add_record (name, value) = let iter = model#append () in model#set ~row:iter ~column:name_col name; model#set ~row:iter ~column:value_col "shit" in List.iter add_record pars everything compiles without a notice. Please, can somebody explain me what I am doing wrong, and what is "universal variable 'b" that escapes from its scope. Big thanks, in advance for any help!