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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 427FABBAF for ; Tue, 23 Mar 2010 02:33:01 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgCAO+2p0vRVd2vkGdsb2JhbACbIggVAQEBAQkJDAcTAx+9YYR9BA X-IronPort-AV: E=Sophos;i="4.51,291,1267398000"; d="scan'208";a="47311705" Received: from mail-qy0-f175.google.com ([209.85.221.175]) by mail3-smtp-sop.national.inria.fr with ESMTP; 23 Mar 2010 02:33:00 +0100 Received: by qyk5 with SMTP id 5so4252045qyk.13 for ; Mon, 22 Mar 2010 18:32:59 -0700 (PDT) Received: by 10.224.123.80 with SMTP id o16mr1021070qar.137.1269307979615; Mon, 22 Mar 2010 18:32:59 -0700 (PDT) Received: from [192.168.1.182] (pool-71-182-209-171.pitbpa.east.verizon.net [71.182.209.171]) by mx.google.com with ESMTPS id 2sm904178qwi.51.2010.03.22.18.32.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 22 Mar 2010 18:32:58 -0700 (PDT) Message-ID: <4BA81A46.1030004@grant-olson.net> Date: Mon, 22 Mar 2010 21:32:54 -0400 From: Grant Olson Reply-To: kgo@grant-olson.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Yoann Padioleau Cc: caml-list@inria.fr Subject: Re: [Caml-list] Building multiple configurations? References: <4BA80CB5.4080402@grant-olson.net> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; runtime:01 flags:01 parser:01 ocaml:01 compile-time:01 runtime:01 syntax:01 ifdef:01 ifdef:01 dependencies:01 dependencies:01 config:01 wrote:01 compile:01 caml-list:01 On 3/22/2010 9:13 PM, Yoann Padioleau wrote: >> >> I've got a configuration file that's a .ml file. And I do want it to be >> an .ml file that gets included at compile time, not some .txt config >> file that gets read in at runtime. I'm building two different versions >> of my app, with two different configurations. > > Why ? Why ? Why not having your app configurable with a txt file > or some command line flags like every other programs ? > Because it's an elaborate configuration. I don't want to write an equally elaborate parser when I've already got ocaml to do that for me. I'd rather get a compile-time error than a runtime error if the syntax is bad. And the app isn't designed to be user-configured. >> >> Basically, I want to do the same thing as a C #ifdef: >> >> #ifdef VERSION2 >> ... include version one >> #else >> ... include version two >> #endif > > People use that because they want to do different things depending on the architecture, or > if some dependencies are present or not. Do you have the same requirement here ? > They also use it for things like debug/release build. But I suppose you could say that the two configurations have totally different dependencies for these purposes. I know what I'm doing is a little weird. But I have my reasons for wanting to do it this way.