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=0.0 required=5.0 tests=AWL 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 AB38ABC0A for ; Fri, 17 Nov 2006 01:36:51 +0100 (CET) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kAH0akl4000901 for ; Fri, 17 Nov 2006 01:36:50 +0100 Received: from ppp39-78.lns2.syd6.internode.on.net (HELO rosella) ([59.167.39.78]) by ipmail02.adl2.internode.on.net with ESMTP; 17 Nov 2006 11:06:20 +1030 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAIKSXEU7pydO/2dsb2JhbAA X-IronPort-AV: i="4.09,431,1157293800"; d="scan'208"; a="47172568:sNHT4751045957" Subject: Re: [Caml-list] managing ocaml dependencies From: skaller To: Nicolas Pouillard Cc: autoconf@gnu.org, caml-list@yquem.inria.fr In-Reply-To: References: <455C73BA.1030803@inria.fr> <1163695632.20151.34.camel@rosella.wigram> Content-Type: text/plain Date: Fri, 17 Nov 2006 11:36:15 +1100 Message-Id: <1163723775.26157.87.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 455D041E.004 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 dependencies:01 0100,:01 ocaml:01 dependencies:01 compiler:01 arises:01 pre-compiled:01 compiler:01 recompiled:01 eliminates:98 sourceforge:01 sourceforge:01 wrote:01 wrote:01 On Thu, 2006-11-16 at 22:43 +0100, Nicolas Pouillard wrote: > On 11/16/06, skaller wrote: > When order of initialization matters, just enforce it. > > For example: > > > > (* file 1 *) > > let a : int opt = ref None > > ;; > > > > (* file 2 *) > > let _ = a := Some 99 > > ;; > > > > (* file 3 *) > > Just add something like: > > open File2;; (* because initialization order matters *) Really there should be a directive such as: require File2;; or something, implied by 'open', and *mandatory* so that List.fold_left without a require/open List;; was an error. In any case, using make for this kind of job is a real negative for Ocaml. Felix compiles dependencies recursively and conditionally. It makes using it -- and upgrading it -- a breeze, and eliminates the need for external tool support. Hmm. It would be interesting to write a driver harness that did this. The biggest impediment is the lack of an enforced 'require' directive, and the existence of Ocamlp4, both of which make it hard to use simple analysis tools to calculate dependencies. BTW: in the Felix compiler itself the initialisation order problem arises with the 'version' record: whenever any code changes, the time stamp in the version record is updated. The version record is first in the link order, so any part of the code can refer to it .. but the actual time stamp is last in link order to avoid gratuitous recompilations. Its module uses the above trick -- the time stamp is stored into the version record by executable initialisation code dynamically before any functions are called in the mainline. This implies that no modules refer to the version record dynamically in initialisations (except the mainline). This is nasty because this version record is Marshalled out into pre-compiled Felix code, and is actually then used for the dependency checking in Felix -- if the compiler version changes the Felix sources need to be recompiled. So there is a 'exponential' dependency situation, where getting the order right is critical, hard to enforce, and hard to detect when there is an error. Skallers Law: if a programmer can make a mistake .. skaller will make it. -- John Skaller Felix, successor to C++: http://felix.sf.net