From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 29830BC57 for ; Fri, 17 Dec 2010 10:19:52 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAJe5Ck2A1gkBe2dsb2JhbACWFo4/AQEWIgUfw2eFSgQ X-IronPort-AV: E=Sophos;i="4.59,360,1288566000"; d="scan'208";a="84283920" Received: from courier.cs.helsinki.fi (HELO mail.cs.helsinki.fi) ([128.214.9.1]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Dec 2010 10:19:51 +0100 Received: from melkinpaasi.cs.helsinki.fi (melkinpaasi.cs.helsinki.fi [128.214.9.14]) (AUTH: PLAIN cs-relay, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by mail.cs.helsinki.fi with esmtp; Fri, 17 Dec 2010 11:19:50 +0200 id 00093E78.4D0B2B36.000047F8 Received: by melkinpaasi.cs.helsinki.fi (Postfix, from userid 37211) id A3AA48DF5F; Fri, 17 Dec 2010 11:19:50 +0200 (EET) Date: Fri, 17 Dec 2010 11:19:50 +0200 From: Lauri Alanko To: caml-list@inria.fr Subject: Unimplemented modules as top-level signatures Message-ID: <20101217091950.GA28557@melkinpaasi.cs.helsinki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam: no; 0.00; lauri:01 alanko:01 ocaml:01 complicates:01 foo:01 mli:01 foo:01 pitfalls:01 functors:01 lauri:01 alanko:01 signatures:01 minor:01 modules:02 defining:02 A minor annoyance in OCaml is that although you can (and must) put each top-level module into its own file, there is no corresponding mechanism for defining module types on their own: you always have to put a "module type" definition inside another module, which complicates scoping, and with standard tools adds an extra level of indentation to the signature definition. However, with 3.12 there is solution of sorts: write the signature definition in foo.mli without an accompanying foo.ml, and then refer to the signature as "module type of Foo". Is this horrible style? Are there some pitfalls I should be aware of? Or are there better solutions to my desire to avoid nested scoping? Top-level functors would also be nice to have... :) Lauri Alanko la@iki.fi