caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jan Kybic <kybic@fel.cvut.cz>
To: caml-list@inria.fr
Subject: Ocamlopt+macros, caching MetaOcaml code. Was: Conditional compilation wrt OCaml version?
Date: Thu, 29 Jan 2009 09:43:58 +0100	[thread overview]
Message-ID: <87vdrya4dt.fsf_-_@fel.cvut.cz> (raw)
In-Reply-To: <slrngnsbeo.e8q.sylvain@gallu.homelinux.org> (Sylvain Le Gall's message of "Mon, 26 Jan 2009 21:40:40 +0000 (UTC)")

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


  reply	other threads:[~2009-01-29  8:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-26 21:25 David Rajchenbach-Teller
2009-01-26 21:40 ` Sylvain Le Gall
2009-01-29  8:43   ` Jan Kybic [this message]
2009-01-29 13:00     ` [Caml-list] Ocamlopt+macros, caching MetaOcaml code. Was: " Jérémie Dimino
2009-01-29  9:21   ` [Caml-list] " David Rajchenbach-Teller
2009-01-26 22:58 ` [Caml-list] " Mikkel Fahnøe Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vdrya4dt.fsf_-_@fel.cvut.cz \
    --to=kybic@fel.cvut.cz \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).