From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA03033; Tue, 10 Dec 2002 14:21:15 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA02589 for ; Tue, 10 Dec 2002 14:21:15 +0100 (MET) Received: from isis.lip6.fr (isis.lip6.fr [132.227.60.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gBADLE129114 for ; Tue, 10 Dec 2002 14:21:14 +0100 (MET) Received: from spi.lip6.fr (IDENT:root@spi.lip6.fr [132.227.83.55]) by isis.lip6.fr (8.12.4/jtpda-5.4+victor) with ESMTP id gBADLD48032761 for ; Tue, 10 Dec 2002 14:21:14 +0100 X-pt: isis.lip6.fr Received: from inria.fr (macaque.lip6.fr [132.227.83.193]) by spi.lip6.fr (8.8.7/jtpda-5.2) with ESMTP id OAA23031 for ; Tue, 10 Dec 2002 14:21:13 +0100 Date: Tue, 10 Dec 2002 14:20:54 +0100 Subject: Re: [Caml-list] Camlp4: generating printers of types Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) From: Damien Doligez To: caml-list@inria.fr Content-Transfer-Encoding: 7bit In-Reply-To: <3DF54B05.6E72368@earthlink.net> Message-Id: <363DCB5E-0C42-11D7-B751-0003930FCE12@inria.fr> X-Mailer: Apple Mail (2.548) X-Scanned-By: isis.lip6.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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