English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] camlp4: ONCE construct
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-01-10 (22:36)
From: Yutaka OIWA <oiwa@y...>
Subject: Re: [Caml-list] camlp4: ONCE construct
>> On Fri, 10 Jan 2003 14:14:14 -0500, jehenrik <jehenrik@yahoo.com> said:

jehenrik> Hi,
jehenrik> I would like to write a Camlp4 construct which causes its argument to
jehenrik> only be evaluated once.  Eg:

jehenrik> ...
jehenrik> 	...
jehenrik> 		...
jehenrik> 			ONCE Pcre.regexp "([0-9]+)"

jehenrik> would be transformed to:

jehenrik> let gensym000 = Pcre.regexp "([0-9]+)";;
jehenrik> ...
jehenrik> 	...
jehenrik> 		...
jehenrik> 			gensym000

See an article by Francois Pottier at
for (almost direct) answer.

Here is my question: Is there any way to declare a
module-local variable without using .mli signature?
It may not be prefarable for direct use by OCaml programmers
(than signature approach), but is useful for camlp4 programmers
to avoid name crashes caused by "open" or "include" directive.

I have implemented a more powerful syntax extension for regular
expression matching, and I'm now preparing a documentation.
I'll release it for caml-list within this month (hopefully).

Yutaka Oiwa              Yonezawa Lab., Dept. of Computer Science,
      Graduate School of Information Sci. & Tech., Univ. of Tokyo.
      <oiwa@yl.is.s.u-tokyo.ac.jp>, <yutaka@oiwa.shibuya.tokyo.jp>
PGP fingerprint = C9 8D 5C B8 86 ED D8 07  EA 59 34 D8 F4 65 53 61
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners