« Return to Thread: "ocaml_beginners"::[] Conditional compilation

Re: "ocaml_beginners"::[] Conditional compilation

by Joerg van den Hoff-2 :: Rate this Message:

Reply to Author | View in Thread

On Sun, Oct 28, 2007 at 08:07:46PM -0000, cultural_sublimation wrote:

> Fellow Camels,
>
> How does one handle conditional compilation in OCaml?  I want certain
> pieces of debugging code to be included only if a certain environment
> variable is set.  This sort of thing is really easy to do in the C
> preprocessor with #ifdefs.
>
> And yes, I know I can use cpp also with OCaml, but I was wondering
> if there was a more "bactrian" way of doing this.
>
> Thanks,
> C.S.
>

is  using  `Sys.getenv'  to  simple  minded  and  out of the
question?  this is not conditional compilation, sure, but if
you      use      a     reasonable     "unprobable"     name
("MYPROGRAM_DEBUGGING_OUTPUT"  ...)  for   the   environment
variable, it would do the job, essentially.

joerg

 « Return to Thread: "ocaml_beginners"::[] Conditional compilation