<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/01/5281362186fca4f0b07ae26e7e735b89"
  from="Yutaka OIWA &lt;oiwa@y...&gt;"
  author="Yutaka OIWA"
  date="2003-01-10T22:36:07"
  subject="Re: [Caml-list] camlp4: ONCE construct"
  prev="2003/01/abff6aa395818df18298e4883094b59c"
  next="2003/01/749cc246a902f0545aa1d76619448186"
  prev-in-thread="2003/01/1889606e7800e49e46e01c0a3d7cecd9"
  next-in-thread="2003/01/749cc246a902f0545aa1d76619448186"
  prev-thread="2003/01/9eafc8c29bd075f861777389ece4e829"
  next-thread="2003/01/5c5d8ca29ec6a960f9735772bd364443"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] camlp4: ONCE construct">
<msg 
  url="2003/01/1889606e7800e49e46e01c0a3d7cecd9"
  from="jehenrik &lt;jehenrik@y...&gt;"
  author="jehenrik"
  date="2003-01-10T19:14:12"
  subject="[Caml-list] camlp4: ONCE construct">
<msg 
  url="2003/01/5281362186fca4f0b07ae26e7e735b89"
  from="Yutaka OIWA &lt;oiwa@y...&gt;"
  author="Yutaka OIWA"
  date="2003-01-10T22:36:07"
  subject="Re: [Caml-list] camlp4: ONCE construct">
<msg 
  url="2003/01/749cc246a902f0545aa1d76619448186"
  from="jehenrik &lt;jehenrik@y...&gt;"
  author="jehenrik"
  date="2003-01-11T01:23:14"
  subject="Re: [Caml-list] camlp4: ONCE construct">
</msg>
</msg>
</msg>
</thread>

<contents>
&gt;&gt; On Fri, 10 Jan 2003 14:14:14 -0500, jehenrik &lt;jehenrik@yahoo.com&gt; said:

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

jehenrik&gt; ...
jehenrik&gt; 	...
jehenrik&gt; 		...
jehenrik&gt; 			ONCE Pcre.regexp "([0-9]+)"

jehenrik&gt; would be transformed to:

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

See an article by Francois Pottier at
http://caml.inria.fr/archives/200107/msg00187.html
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.

P.S.
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. &amp; Tech., Univ. of Tokyo.
      &lt;oiwa@yl.is.s.u-tokyo.ac.jp&gt;, &lt;yutaka@oiwa.shibuya.tokyo.jp&gt;
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

</contents>

</message>

