Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Subject: camlp4: How to make a record expression w/o useless "with"
Date: Mon, 11 Aug 2008 17:49:25 +0100	[thread overview]
Message-ID: <20080811164924.GA17563@annexia.org> (raw)

I have some code like the minimal example below.  Notice the
  '{ () with ... }'
record expression.  If I remove the '() with' part, it fails to
compile.

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
http://brion.inria.fr/gallium/index.php/Abstract_Syntax_Tree
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$ } >>
  ------------------------------------------------------------

Rich.

-- 
Richard Jones
Red Hat


             reply	other threads:[~2008-08-11 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-11 16:49 Richard Jones [this message]
2008-08-12 17:37 ` [Caml-list] " Richard Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080811164924.GA17563@annexia.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox