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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id CDBBF7ED25 for ; Sun, 14 Jul 2013 20:24:04 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of michipili@gmail.com) identity=pra; client-ip=74.125.83.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="michipili@gmail.com"; x-sender="michipili@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of michipili@gmail.com designates 74.125.83.41 as permitted sender) identity=mailfrom; client-ip=74.125.83.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="michipili@gmail.com"; x-sender="michipili@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ee0-f41.google.com) identity=helo; client-ip=74.125.83.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="michipili@gmail.com"; x-sender="postmaster@mail-ee0-f41.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsYBAFbs4lFKfVMpjWdsb2JhbABZhw++SIEKFg4BAQEBBwsUEgYkgiQBBSMECwENARscAQEDDAYFCw8CBRMDCwICCQMCAQIBEREBBQEcBgEMAQcCh3kBAw8EmQGLf0+Cf4NYChknDWSHdAEFDIEajgszB4JYgSADjxiIRI9oP4Q6 X-IPAS-Result: AsYBAFbs4lFKfVMpjWdsb2JhbABZhw++SIEKFg4BAQEBBwsUEgYkgiQBBSMECwENARscAQEDDAYFCw8CBRMDCwICCQMCAQIBEREBBQEcBgEMAQcCh3kBAw8EmQGLf0+Cf4NYChknDWSHdAEFDIEajgszB4JYgSADjxiIRI9oP4Q6 X-IronPort-AV: E=Sophos;i="4.89,664,1367964000"; d="scan'208";a="25962414" Received: from mail-ee0-f41.google.com ([74.125.83.41]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 14 Jul 2013 20:23:40 +0200 Received: by mail-ee0-f41.google.com with SMTP id d17so7289547eek.28 for ; Sun, 14 Jul 2013 11:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=YZwooRBl03pgWVRnvsp1B2mzuZtW3aE6wNSfwX2LtxU=; b=jszVk+Px6Ibkq38zIHlK1plX+TzxfI/PsUlU7SQiSmQw9eMM7O200a0tEzVvNQqkO3 o85a4hiRTWRIcLdqhhqcgExi3zIQcl3DfmH3/oi8K0J0Lb0Rn4ePWz5es1lc97DWvYMf zvGsYQeNuS4zRuhYqmadHLYwOgv38fYWHaFdB8nBdFJ+4Rz9pXJdNyBqjJ/K3DBbvfYl paEL73yJCqIGPPpk2c/8CP0PWIFeeP44cQIu3kvHWpINzLzPa4d6rp0Qwzw0v2PbHlKe lehJmtrTE45wOH2QX08fhLeAe3McdyJXCEumyYXVGOe2PThd3tZ0NMdLxoE7V1rHCYcA cspQ== X-Received: by 10.14.5.68 with SMTP id 44mr22332292eek.141.1373826219567; Sun, 14 Jul 2013 11:23:39 -0700 (PDT) Received: from llea.celt.neu (xdsl-89-0-166-120.netcologne.de. [89.0.166.120]) by mx.google.com with ESMTPSA id p49sm96476836eeu.2.2013.07.14.11.23.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 14 Jul 2013 11:23:38 -0700 (PDT) Message-ID: <51E2ECA9.4070203@gmail.com> Date: Sun, 14 Jul 2013 20:23:37 +0200 From: Michael User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121104 Firefox/16.0 SeaMonkey/2.13.2 MIME-Version: 1.0 To: =?UTF-8?B?RGFuaWVsIELDvG56bGk=?= , Anil Madhavapeddy CC: caml-list@inria.fr References: <51DBD740.3020109@gmail.com> <572AABCBE61A44C0B2CF24F9B03CBEDC@erratique.ch> In-Reply-To: <572AABCBE61A44C0B2CF24F9B03CBEDC@erratique.ch> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Re: Opening a module from toploop startup Hi Daniel, Hi Anil, thank you very much for your very useful answers, they helped a lot! I could have a look at them today, and I studied in more details the toplevel code, and since the startup hook is processed before that the toplevel has been initialised, it is probably not a good place to open modules: let main () = Arg.parse Options.list file_argument usage; if not (prepare Format.err_formatter) then exit 2; Toploop.loop Format.std_formatter let loop ppf = fprintf ppf " OCaml version %s@.@." Config.version; initialize_toplevel_env (); … let prepare ppf = Toploop.set_paths (); try let res = List.for_all (Topdirs.load_file ppf) (List.rev !preload_objects) in !Toploop.toplevel_startup_hook (); res with x -> … A better place to open these modules is probably the initialisation file. The example of the “core-runner-toplevel” shows well how to write an alternate toplevel, I will probably found it very useful when I will need more substantial amenagements. Regards, Michael