caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Camlp4: generating printers of types
Date: Tue, 10 Dec 2002 14:20:54 +0100	[thread overview]
Message-ID: <363DCB5E-0C42-11D7-B751-0003930FCE12@inria.fr> (raw)
In-Reply-To: <3DF54B05.6E72368@earthlink.net>

On Tuesday, Dec 10, 2002, at 03:01 Europe/Paris, Ken Rose wrote:

> type t = int let rec print_t = print_int
>
> Which the compiler rejects with "This kind of expression is not allowed
> as right-hand side of `let rec'"  I haven't been able to figure out a
> way to sneak it past, either.  What's going on here?  Why can't I 
> rename
> print_int?

The problem here is that you are using "let rec" to define a
non-functional value which is not recursive.  O'Caml 3.06 can handle
some such definitions but not all of them.  We have worked a bit on
the "let rec" restrictions and the current CVS version of O'Caml accepts
all non-recursive definitions in a let rec.

You have several solutions:
1. wait for the next release of O'Caml (no expected date yet)
2. use the CVS version (and be a beta-tester)
3. get rid of the "rec" in your generated code in the case where you
    are only renaming a function
4. use eta-conversion to make it a functional value:
      let rec print_t x = print_int x

-- Damien

-------------------
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


      parent reply	other threads:[~2002-12-10 13:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-09 13:13 Daniel de Rauglaudre
2002-10-09 17:18 ` Markus Mottl
2002-10-25 19:20 ` Ken Rose
2002-10-25 20:02   ` Chris Hecker
2002-10-26  0:11   ` Daniel de Rauglaudre
2002-12-10  2:01 ` Ken Rose
2002-12-10 12:25   ` Daniel de Rauglaudre
2002-12-10 15:33     ` Ken Rose
2002-12-10 17:38       ` Daniel de Rauglaudre
2002-12-10 13:20   ` Damien Doligez [this message]

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=363DCB5E-0C42-11D7-B751-0003930FCE12@inria.fr \
    --to=damien.doligez@inria.fr \
    --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;
as well as URLs for NNTP newsgroup(s).