Browse thread
[Caml-list] Camlp4: generating printers of types
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Damien Doligez <damien.doligez@i...> |
| Subject: | Re: [Caml-list] Camlp4: generating printers of types |
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