From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5E8B5BC0A for ; Thu, 15 Mar 2007 04:04:04 +0100 (CET) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [204.127.192.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2F34076017829 for ; Thu, 15 Mar 2007 04:04:03 +0100 Received: from [192.168.0.6] (c-24-61-181-86.hsd1.nh.comcast.net[24.61.181.86]) by comcast.net (rwcrmhc12) with ESMTP id <20070315030358m1200hle4ce>; Thu, 15 Mar 2007 03:03:58 +0000 Message-ID: <45F87661.4020504@softhome.net> Date: Wed, 14 Mar 2007 17:25:37 -0500 From: ian User-Agent: Thunderbird 1.5.0.8 (X11/20061203) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Style and organization of code Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 45F8B7A0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 compiler:01 mli:01 sig:01 struct:01 fist:98 softhome:98 instinct:98 functions:01 functions:01 define:01 ian:03 module:03 module:03 I'm looking for a guidebook or just some rules of thumb on how to organize my OCaml code. One example: Say I have a function called "solveHardProblem". solveHardProblem relies on several helper functions, which are not going to be useful to any other functions in the program. So, my first instinct would be to define all the helpers using let blocks within the definition of solveHardProblem. But that would make the definition of solveHardProblem really long -- several screens of text -- which I've been taught to avoid. Is it wrong to use a module to hide those functions if the module signature will contain only that of solveHardProblem? And say you DO choose to use a module... The OCaml documentation says that the compiler can automatically infer the signature without the need to create a .mli file for it. Does anyone actually use that feature in practice, or is creating a sig hard-wired to the act of creating a struct? Thanks, -Ian