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
camlp4: How to make a record expression w/o useless "with"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: camlp4: How to make a record expression w/o useless "with"
I have some code like the minimal example below.  Notice the
  '{ () with ... }'
record expression.  If I remove the '() with' part, it fails to

Now the problem is that I'm actually using camlp4 to generate code
which gets saved in an ml file.  In other words I'm using
'Printers.OCaml.print_implem' to print out the final code.  The
useless '() with' causes a non-fatal but annoying warning (X) when the
generated code is compiled later on.

How can I get rid of it?  According to
the version without the useless '() with' ought to work, so maybe this
is a camlp4 bug?

This is OCaml 3.10.2.

  open Camlp4.PreCast
  open Syntax
  let _loc = Loc.ghost
  let rbs =
    <:rec_binding< foo = bar ; baz = quux >>
  let record = <:expr< { () with $rbs$ } >>


Richard Jones
Red Hat