Version franaise
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
Conditional compilation wrt OCaml version?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-29 (13:00)
From: Jérémie Dimino <jeremie@d...>
Subject: Re: [Caml-list] Ocamlopt+macros, caching MetaOcaml code. Was: Conditional compilation wrt OCaml version?

Jan Kybic <> writes:

> Good morning. I have looked at ocamlopt and it looks very useful. 
> Are there any plans to include macro expansion in ocamlopt?

Right now there is no plan for that. My only intention when i started
optcomp was conditional compilation, and i made choices making it
incompatible with macro expansion.

By the way, it would be easy to transform it into a macro expansion

> I mean something like merging the functionality of ocamlopt and
> pa_macro but without the restrictions that pa_macro places on 
> where the macro can be used.

Yes, these restrictions could be bypassed because it modify directly the
stream of tokens.

The disadvantage of dealing with macros is for expressions needing to be
evaluated at compile time. For example in that case, assuming the
variable "x" is not defined:

| #let y = x
| #if y
| ...
| #endif

the error would be raised at the "#if y" line. Whereas it is raised at
the "#let y = x" line with optcomp. That is mostly why i decided not to
design it as a macro expansion system.