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 977407F249 for ; Tue, 30 Oct 2012 03:21:16 +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.175; 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.175 as permitted sender) identity=mailfrom; client-ip=134.160.33.175; 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.175 as permitted sender) identity=helo; client-ip=134.160.33.175; 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: AvAAAL04j1CGoCGvl2dsb2JhbAA+BrEckkQBAQEBAQgWBzuCHgEBBAE4NgoBBQsLDgQGCQQSCAcJAwIBAgEzAQMOBg0BBQIBAQ6HYgMJBgurb4Y7A4lei3UmhjcDiFeNHYEahE+NVw X-IronPort-AV: E=Sophos;i="4.80,676,1344204000"; d="scan'208";a="160826907" Received: from postman3.riken.jp (HELO postman.riken.jp) ([134.160.33.175]) by mail4-smtp-sop.national.inria.fr with ESMTP; 30 Oct 2012 03:21:14 +0100 Received: from postman.riken.jp (postman3.riken.jp [127.0.0.1]) by postman.riken.jp (Postfix) with SMTP id 5B4BA38380C1; Tue, 30 Oct 2012 11:21:11 +0900 (JST) Received: from [172.27.98.103] (rikad98.riken.jp [134.160.214.98]) by postman.riken.jp (Postfix) with ESMTPA id D3C5B382020D; Tue, 30 Oct 2012 11:21:10 +0900 (JST) Message-ID: <508F3996.2050609@riken.jp> Date: Tue, 30 Oct 2012 11:21:10 +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: Peter Groves 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.20915 Subject: Re: [Caml-list] Why should I use .mli files? On 10/30/2012 10:04 AM, Peter Groves wrote: > If you only do small projects, you're probably doing things right by > ignoring the .mli files. Languages like Ruby and Python don't have > signature files and that's part of what makes them good for scripting tasks. > > But since you asked, here's why I use mli files almost always: > > 1) The signature files are my "architecture." When I start implementing > something substantial, I'll first make the .mli files for the modules I > think I'll need. I can pretty quickly refactor them until they make > sense semantically and compile against each other. It's not unusual for > me to change an .mli file 10 times before I bother starting to implement > it. After that, I just use the unimplemented methods as my todo list. OK, so as part of a top-down design approach, plus as milestones for a project. Interesting. > 2) Documentation. Sometimes I have a module with a 1000 line .ml file > and 30 line .mli file (with comments). Much easier to refer to the .mli > to reuse it's methods. I see. Thanks, F. > -Peter > > On Mon, Oct 29, 2012 at 7:43 PM, 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. > > Thanks a lot, > Francois. > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/__arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/__ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-__bugs > > >