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 AC4327F249 for ; Tue, 30 Oct 2012 08:44:20 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of mlin@mlin.net) identity=pra; client-ip=209.85.215.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mlin@mlin.net"; x-sender="mlin@mlin.net"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of mlin@mlin.net) identity=mailfrom; client-ip=209.85.215.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mlin@mlin.net"; x-sender="mlin@mlin.net"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-la0-f54.google.com) identity=helo; client-ip=209.85.215.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="mlin@mlin.net"; x-sender="postmaster@mail-la0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqoCAPqDj1DRVdc2k2dsb2JhbABEsSGSDwgjAQEBAQkJCwkUBCOCHgEBAQQSAloLEAsLDQ0hIhIBBQEKEgYTEhCHUgMPC50FYgkDjhyGPAOJXot1hl0DiFmJaYMygRqNRxYphDGBeQ X-IronPort-AV: E=Sophos;i="4.80,677,1344204000"; d="scan'208";a="160842802" Received: from mail-la0-f54.google.com ([209.85.215.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 30 Oct 2012 08:44:19 +0100 Received: by mail-la0-f54.google.com with SMTP id e12so7681726lag.27 for ; Tue, 30 Oct 2012 00:44:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:x-gm-message-state; bh=LiuqpR+JLm2+SqPV7qCgEfQjP1SlvWJ3GckebmuwTbM=; b=ouk9JuKnBv2ig7CW4cAoNlYVKYkW9umYYOnBvndLDEZF0p+7PkcduTIxKttftcy3N5 cKaSeMKZiYEyZl/jIwNog8sqlA4ta82yb0SBi3MAkJWqTMiu+THFSZ0K905sBSYcRsZl g8y7rG16t+TFH+iLqxxIkjoMBxgyvIHI0uUHtlnFyH1mmroxr0WMlaWrzpZLNPMG6eIR X8WEEw0fMmhagQ3/dKS56USKQFZz0JAGT3mFu2Fx64CK9C+8lJs+ievv5RmMEtas1r40 zHe6eHiPfcz96M1k2awV1orlRlGjiCOiodGHnly8zGSsBZngXR5iQ6I2q52hXltkW6IH wo9w== Received: by 10.152.47.112 with SMTP id c16mr30016236lan.50.1351583058718; Tue, 30 Oct 2012 00:44:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.154.165 with HTTP; Tue, 30 Oct 2012 00:43:58 -0700 (PDT) X-Originating-IP: [75.94.131.145] In-Reply-To: <508F22BD.7010103@riken.jp> References: <508F22BD.7010103@riken.jp> From: Mike Lin Date: Tue, 30 Oct 2012 00:43:58 -0700 Message-ID: To: Francois Berenger Cc: caml-list Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnIY5UN9JMy+6ghXc4+xC0m9lG99bSC4jf9r9Wtup8ycyU7EkE48/mxNO272bQ8RIbd6SPU X-Validation-by: mlin@mlin.net Subject: Re: [Caml-list] Why should I use .mli files? Here are a couple minor benefits that I didn't notice mentioned yet: 1) If you inadvertently/carelessly change the signature of a function/record/class, you will get a compilation error. (Lots of ways to get that; this is one of them) 2) You can declare things in the .mli file in a different order than they appear in the .ml file, and declare mutually recursive functions separately. This allows you to structure your ocamldoc in the way you think will be most beneficial to the reader, rather than whatever order is dictated by the call graph in the implementation. On Mon, Oct 29, 2012 at 5: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