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 2E9917F249 for ; Tue, 30 Oct 2012 02:15:09 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of av1474@comtv.ru) identity=pra; client-ip=77.232.31.165; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="av1474@comtv.ru"; x-sender="av1474@comtv.ru"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of av1474@comtv.ru) identity=mailfrom; client-ip=77.232.31.165; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="av1474@comtv.ru"; x-sender="av1474@comtv.ru"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@akado.ru) identity=helo; client-ip=77.232.31.165; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="av1474@comtv.ru"; x-sender="postmaster@akado.ru"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4IAM0oj1BN6B+lXmdsb2JhbABEvy2DdhgLChkqgh4BAQQBOj8FCws/B0MDEQYTiAAKq3aQGYt1hl0DiFOFNY1VjU0 X-IronPort-AV: E=Sophos;i="4.80,675,1344204000"; d="scan'208";a="160824587" Received: from fe02x03-cgp.akado.ru (HELO akado.ru) ([77.232.31.165]) by mail4-smtp-sop.national.inria.fr with ESMTP; 30 Oct 2012 02:15:07 +0100 Received: from [10.0.66.9] ([10.0.66.9] verified) by fe02-cgp.akado.ru (CommuniGate Pro SMTP 5.2.13) with ESMTPS id 291444228; Tue, 30 Oct 2012 05:15:05 +0400 Date: Tue, 30 Oct 2012 05:15:04 +0400 (MSK) From: malc X-X-Sender: malc@linmac To: Francois Berenger cc: caml-list In-Reply-To: <508F22BD.7010103@riken.jp> Message-ID: References: <508F22BD.7010103@riken.jp> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [Caml-list] Why should I use .mli files? 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, making it necessary to play build system games if one cares more about compile rather than run time). -- mailto:av1474@comtv.ru