Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
small Camlp4 code : get a free name
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-01-23 (21:35)
From: Edgar Friendly <thelema314@g...>
Subject: Re: [Caml-list] small Camlp4 code : get a free name
Martin Jambon wrote:
 > Nice, but in theory, it may create identifiers that are bound to an
> incorrect value when the programmer forgot to define such a value.
> For example, module A should provide A.x to module B (= another .ml file).
> If the programmer forgets to define A.x, the compiler should report the
> error at the time of compiling But if some camlp4 extension
> operating over introduces a variable A.x and by chance it has the
> same type as the expected A.x, then the compiler will remain silent and
> B will use the wrong value for A.x.
> Martin
It seems to me that the only way to satisfy this requirement involves a
distinct namespace for these variables.  Maybe
Camlp4.Unique_identifiers.<generated identifier>?

But this seems isomorphic to the simpler solution of claiming a portion
of the identifier space: __camlp4_unique_identifier_<generated identifier>.