From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA02013; Fri, 12 Sep 2003 14:15:50 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA28975 for ; Fri, 12 Sep 2003 14:15:48 +0200 (MET DST) Received: from mwinf0803.wanadoo.fr (smtp1.wanadoo.fr [193.252.22.23]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h8CCFlT11177; Fri, 12 Sep 2003 14:15:47 +0200 (MET DST) Received: from oops (ARennes-303-1-24-253.w81-53.abo.wanadoo.fr [81.53.39.253]) by mwinf0803.wanadoo.fr (SMTP Server) with ESMTP id 15C761800101; Fri, 12 Sep 2003 14:15:47 +0200 (CEST) Received: from david by oops with local (Exim 3.35 #1 (Debian)) id 19xmq1-0000Om-00; Fri, 12 Sep 2003 14:15:45 +0200 To: Xavier Leroy Cc: caml-list@inria.fr Subject: Re: [Caml-list] How to avoid compiling some code (like #ifdef in C) References: <87llswpnvn.fsf@linux-france.org> <20030911173056.A29749@pauillac.inria.fr> From: David MENTRE Organization: none Date: Fri, 12 Sep 2003 14:15:45 +0200 In-Reply-To: <20030911173056.A29749@pauillac.inria.fr> (Xavier Leroy's message of "Thu, 11 Sep 2003 17:30:56 +0200") Message-ID: <8765jyfbim.fsf@linux-france.org> User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dmentre:01 ocamlopt:01 type-checked:01 type-checked:01 3.0.:01 dmentre:01 ifdef:01 approaches:01 toplevel:01 writes:01 mentre:01 mentre:01 checking:01 checking:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello Xavier, Xavier Leroy writes: > With ocamlopt, that code is eliminated as part of constant > propagation. Thank you to confirm my guess. >> Does anybody see a better approach to do such a thing? > Whether this is a "better" approach is open to debate. With a > preprocessor, you can remove not just code for expressions, but also > other kind of code, e.g. code for the toplevel binding "let a() = ...". > So, you get more flexibility, but at the expense of less static > checking. In particular, code that is #ifdef-ed out is not > type-checked, while it is type-checked in your solution above. I'm personally find that static checking is very useful. So, for my own issue, the approach I proposed is "better". It allows me to be sure that all automatics tests will always at least compile. And it works on O'Caml 3.04 available in my old debian 3.0. But I'll keep in my mind the two other approaches. Thank you for your answer, Yours, david -- David Mentré http://www.linux-france.org/~dmentre/david-mentre-public-key.asc GnuPG key fingerprint: A7CD 7357 3EC4 1163 745B 7FD3 FB3E AD7C 2A18 BE9E ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners