Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
How to cleanly encode "quasi-constants"?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: How to cleanly encode "quasi-constants"?

On Fri, Jun 23, 2000 at 04:27:00PM +0200, Remi VANICAT wrote:

> I have a question about this : is there a way to make easily a compile
> time constants?
> (if i have a let var = func constant_argument, and i know that this
> can't change from an execution to an other, i want it to be evaluated
> only once)

You can use preprocessors: i.e. /lib/cpp (general) or Camlp4 (specific to
Ocaml). In Camlp4, you can do that with "quotations". (I am not sure that
"easily" is appropriate... :-): you have to learn how Camlp4 works).