[wg-camlp4] getting bitstring to work with Core

Xavier Clerc xavier.clerc at inria.fr
Mon May 27 19:05:51 BST 2013


----- Mail original -----
> On 05/27/2013 12:47 PM, Anil Madhavapeddy wrote:
> > - Do nothing, and wait for the more explicit extension_points to
> > show up.
> 
> I believe the situation would be very similar with a version of
> bitstring based on extension_points.  A system of namespaces allowing
> to
> access components from the stdlib explicitly (even if shadowed by
> Core)
> would solve the issue, but this is not directly related to
> extension_points.

I concur.

However, in this particular case, there seems to be a workaround
as the two functions to be accessed are indeed externals. As a
consequence, bitstring could "access them explicitly" in module
"Bitstring" through:
  external string_unsafe_get : string -> int -> char = "%string_unsafe_get"
  external char_code : char -> int = "%identity"
and then emit code where "String.unsafe_get" (respectively "Char.code")
is replaced by "Bitstring.string_unsafe_get" (respectively "Bitstring.char_code).

I acknowledge that it not very elegant, though.


My two cents,

Xavier


More information about the wg-camlp4 mailing list