Version franaise
Home About Download Resources Contact us
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: -- (:)
From: Jérémie Dimino <jeremie@d...>
Subject: Re: [Caml-list] Ocamlopt+macros, caching MetaOcaml code. Was: Conditional compilation wrt OCaml version?

Jan Kybic <kybic@fel.cvut.cz> 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
system.

> 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.

Jérémie