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 NAA00426; Tue, 10 Dec 2002 13:25:03 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA32399 for ; Tue, 10 Dec 2002 13:25:03 +0100 (MET) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gBACP2X17169 for ; Tue, 10 Dec 2002 13:25:02 +0100 (MET) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id NAA03923 for caml-list@inria.fr; Tue, 10 Dec 2002 13:25:02 +0100 Date: Tue, 10 Dec 2002 13:25:02 +0100 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] Camlp4: generating printers of types Message-ID: <20021210132502.J31055@verdot.inria.fr> References: <20021009151317.J1703@verdot.inria.fr> <3DF54B05.6E72368@earthlink.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3DF54B05.6E72368@earthlink.net>; from kenarose@earthlink.net on Mon, Dec 09, 2002 at 06:01:41PM -0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Mon, Dec 09, 2002 at 06:01:41PM -0800, Ken Rose wrote: > 1. Is there a clean way to handle (sum) types with constructors with > multiple module qualifications? I hacked the example to deal with > Foo.bar, but it doesn't seem to extend automatically to Foo.Bar.baz. As > I understand it, I'd need a new pattern for each additional uid. I don't understand that: in the type definition, there is no qualifications for the constructors. > 2. How are tuples represented in camlp4's syntax? This is so I can > match them when analyzing a type. In Revised syntax, they are like in normal syntax, but the parentheses are compulsory. > 3. This is the big one. When working on a type like: > type t = int > with the obvious extention to Daniel's code, the preprocessor produces > 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? This message of OCaml just means that there are syntactic restrictions of the "let rec". In this case, you should produce either a "let" without "rec" or, an eta extension: "let rec print_t x = print_int x". -- Daniel de RAUGLAUDRE http://cristal.inria.fr/~ddr/ ------------------- 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