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.0 required=5.0 tests=AWL,DNS_FROM_SECURITYSAGE autolearn=disabled version=3.1.3 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 452AEBBAF for ; Tue, 18 Nov 2008 23:07:42 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoUBAF/LIknUGypAkWdsb2JhbACTWAEBAQEJCwoHEQO/H4J5 X-IronPort-AV: E=Sophos;i="4.33,627,1220220000"; d="scan'208";a="17344428" Received: from smtp7-g19.free.fr ([212.27.42.64]) by mail2-smtp-roc.national.inria.fr with ESMTP; 18 Nov 2008 23:07:42 +0100 Received: from smtp7-g19.free.fr (localhost [127.0.0.1]) by smtp7-g19.free.fr (Postfix) with ESMTP id D4660B013A for ; Tue, 18 Nov 2008 23:07:41 +0100 (CET) Received: from [192.168.0.3] (rke75-3-82-229-183-156.fbx.proxad.net [82.229.183.156]) by smtp7-g19.free.fr (Postfix) with ESMTP id A66E3B010F for ; Tue, 18 Nov 2008 23:07:41 +0100 (CET) Message-ID: <49233CA5.6080100@frisch.fr> Date: Tue, 18 Nov 2008 23:07:33 +0100 From: Alain Frisch User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2pre) Gecko/20081113 Shredder/3.0b1pre MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Wanted: your feedback on the hierarchy of OCaml Batteries Included References: <1227002178.6170.25.camel@Blefuscu> <20081118100625.GA25627@annexia.org> <200811181817.23216.jon@ffconsultancy.com> In-Reply-To: <200811181817.23216.jon@ffconsultancy.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; frisch:01 frisch:01 ocaml:01 struct:01 sig:01 val:01 struct:01 idioms:01 wrote:01 extensible:01 caml-list:01 int:01 alain:01 alain:01 interfaces:01 On 11/18/2008 7:17 PM, Jon Harrop wrote: > I don't follow. Can you not use "include" to extend an existing module: > > # module Array = struct > include Array > let empty = [||] > end;; > module Array : > sig > external length : 'a array -> int = "%array_length" > ... > val empty : 'a array > end In addition to this being non-modular, this extension scheme does not work well with hiararchy as it forces you to mention all the siblings of the ancestors of the module you want to extend. E.g. if you start from: module M = struct module M1 = struct module M11 = struct ... end module M12 = struct ... end module M13 = struct ... end ... end module M2 = struct ... end module M3 = struct ... end ... end and you want to extend M11, you need to write: module M' = struct module M1 = struct module M11 = struct include M.M1.M11 (* extension here *) end module M12 = M.M1.M12 module M13 = M.M1.M13 ... end module M2 = M.M2 module M3 = M.M3 ... end Frankly, I don't think that having a nice and well-organized hierarchy of modules really matters. Things like having uniform interfaces, consistent idioms and compatible types across libraries seem much more important to me. Anyway, if a hierarchy is desired, I fail to see any advantage of using "." instead of e.g. "_" (easily extensible + does not force you to link everything). -- Alain