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 TAA26989; Wed, 23 May 2001 19:06:22 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA26985 for ; Wed, 23 May 2001 19:06:21 +0200 (MET DST) Received: from hci.ucsd.edu (hci.ucsd.edu [132.239.215.210]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f4NH6Kf28122 for ; Wed, 23 May 2001 19:06:20 +0200 (MET DST) Received: (from dsf@localhost) by hci.ucsd.edu (8.9.3/8.9.3) id KAA27620; Wed, 23 May 2001 10:06:19 -0700 To: caml-list@inria.fr Subject: [Caml-list] ocaml and named constants From: David Fox Date: 23 May 2001 10:06:19 -0700 In-Reply-To: wester@ilt.fhg.de's message of "Wed, 23 May 2001 16:35:46 +0200" Message-ID: X-Mailer: Gnus v5.7/Emacs 20.3 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I've noticed that there is no notion of a named constant in ML. I sort of assumed that the compiler could determine that uses of a variable after a declaration like let mpg_joint_stereo = 1 could be compiled as a constant provided the value was never altered and no references to the variable were created. Does the compiler actually do this? I can't see how it could do it for a variable that wasn't module local. I ask because it seems odd that camlp4 includes a feature for creating real defined constants that are textually substituted before compilation begins. Would it be a better bet to use a function like let is_joint_stereo head = (mpg_mode head) = 1 and hope the compiler inlines the function? -david ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr