Version française
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: Jan Kybic <kybic@f...>
Subject: Ocamlopt+macros, caching MetaOcaml code. Was: Conditional compilation wrt OCaml version?
>>   Working on Batteries, we're faced with a few places where we'd like to
>> perform conditional compilation depending on the version of OCaml being
>> used. We could probably do this with Camlp4, cpp, Autoconf hackery, etc.
>> -- but first, we need to decide on which of these options we'll adopt.
>>
>
> There is optcomp:
> https://forge.ocamlcore.org/projects/optcomp/
> http://darcs.ocamlcore.org/repos/optcomp/optcomp/README
>

Good morning. I have looked at ocamlopt and it looks very useful. 
Are there any plans to include macro expansion in ocamlopt?
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.

Besides conditional compilation - to try different variants of the
code or to have debugging messages which can be switched off without
any performance penalty - I would also like to use it for short pieces
of compile-time generated code (for speed up). Currently, I use a
Python-based templating system em.py
(http://www.alcyone.com/pyos/empy/) for this purpose. This works but
combining the way Python and Ocaml syntax is sometimes not very
intuitive.

It appears that a modern and universal tool for compile-time code
generation is MetaOcaml. However, is there a way in MetaOcaml to
generate the code just once and not every time the program is run? I
mean, can the code fragments be cached - saved into a file (a shared library?)
and later retrieved?

Thanks,

Jan

-- 
-------------------------------------------------------------------------
Jan Kybic <kybic@fel.cvut.cz>                       tel. +420 2 2435 5721
http://cmp.felk.cvut.cz/~kybic                      ICQ 200569450