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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id AB3937F249 for ; Tue, 30 Oct 2012 03:24:56 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of berenger@riken.jp) identity=pra; client-ip=134.160.33.162; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="berenger@riken.jp"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of berenger@riken.jp designates 134.160.33.162 as permitted sender) identity=mailfrom; client-ip=134.160.33.162; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="berenger@riken.jp"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of postmaster@postman.riken.jp designates 134.160.33.162 as permitted sender) identity=helo; client-ip=134.160.33.162; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="postmaster@postman.riken.jp"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvMAANw5j1CGoCGimWdsb2JhbABEv2uDdQEBAQEBCAsLBxQngh4BAQQBOEABBQsLGAkWDwkDAgECAUUGDQEHAQGHfAarepAci3WGXQOIV40dhWmNVw X-IronPort-AV: E=Sophos;i="4.80,676,1344204000"; d="scan'208";a="160827055" Received: from postman2.riken.jp (HELO postman.riken.jp) ([134.160.33.162]) by mail4-smtp-sop.national.inria.fr with ESMTP; 30 Oct 2012 03:24:55 +0100 Received: from postman.riken.jp (postman2.riken.jp [127.0.0.1]) by postman.riken.jp (Postfix) with SMTP id D7F3C1260422; Tue, 30 Oct 2012 11:24:52 +0900 (JST) Received: from [172.27.98.103] (rikad98.riken.jp [134.160.214.98]) by postman.riken.jp (Postfix) with ESMTPA id AF7B91270063; Tue, 30 Oct 2012 11:24:52 +0900 (JST) Message-ID: <508F3A74.4040106@riken.jp> Date: Tue, 30 Oct 2012 11:24:52 +0900 From: Francois Berenger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: malc CC: caml-list References: <508F22BD.7010103@riken.jp> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.10.30.21217 Subject: Re: [Caml-list] Why should I use .mli files? On 10/30/2012 10:15 AM, malc wrote: > On Tue, 30 Oct 2012, Francois Berenger wrote: > >> Hello, >> >> Here is my stupid question of the day: >> what's the use of those .mli files? >> >> Is it just to separate interface from implementation >> so that the implementation of a module can be changed >> without clients of its interface to have to bother? >> >> Does it make compilation of large software faster >> by allowing for more parallelization and maybe later on avoiding to recompile >> some parts? >> >> Usually I program in a pure functional style, so my modules >> don't carry an internal state. >> I feel like "if someone want to re-use a function, so be it". >> If I really want to hide a function that I am afraid people >> may call in an incorrect manner, I declare it internally >> to some public function and use it correctly. >> >> Also, maybe I only work on toy-size OCaml projects. So, I never bothrered to >> create any .mli file. >> I would like to know if I should bother about them. >> > Say you have a 1MLOC .ml(a) that uses something from 100LOC one(b), if you > do not use .mli then every time (b) is touched not only (a) but also (b) > must be recompiled, in .mli case however (a) will be rebuilt only when > the public interface changes. So .mli is a good way to keep separate > compilation useful. However this (in general) only applies to the bytecode > compiler (ocamlopt uses .cmx files for inlining, What about the .cmi files? > making it necessary > to play build system games if one cares more about compile rather than > run time). I care about both compilation time and run-time, as I am an impatient and demanding user.