From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 207CCBC0A for ; Wed, 13 Jun 2007 14:32:02 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.238]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5DCW1j6004128 for ; Wed, 13 Jun 2007 14:32:01 +0200 Received: by nz-out-0506.google.com with SMTP id s18so170851nze for ; Wed, 13 Jun 2007 05:32:00 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Q0LtAzDkj5aw84umL7PAioXMOOwQX5rQmO0Hwi9rzxk77NyCEd/ODGZdF3CW4rH0Ag4P5V8OLIY1BdevhmJhjl56GdhGc5m/4ZRjAAuOZbjFMU9MYuntTXh+Ync1vwKFUb0Yu88M6qOO0wEBxHFh/xc4C+1CZdBOqXYlwuPtuRg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S7LlXz2oscckZxaAZvizQJgJUMaZE/SU0HHixj6dEuZ90TyIph1bv2D+S1phqBkL2fyBDqDyzk/vzLh90ygu6yvqt+i1yPsG8pB7uiq7i9m9ajRg7VwauE9vKWoEFSCLOkpSIZGsh0Lab+xwwbj3yObpdNf2Ic9f1vN3r/qzmEw= Received: by 10.115.89.1 with SMTP id r1mr642145wal.1181737917377; Wed, 13 Jun 2007 05:31:57 -0700 (PDT) Received: by 10.114.181.9 with HTTP; Wed, 13 Jun 2007 05:31:57 -0700 (PDT) Message-ID: Date: Wed, 13 Jun 2007 14:31:57 +0200 From: "Nicolas Pouillard" To: "Richard Jones" Subject: Re: [Caml-list] camlp4 3.10 and ints Cc: caml-list@inria.fr In-Reply-To: <20070613114043.GA14594@furbychan.cocan.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070613114043.GA14594@furbychan.cocan.org> X-j-chkmail-Score: MSGID : 466FE3C1.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 466FE3C1.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 integers:01 conversely:01 parser:01 integers:01 wrote:01 integer:01 integer:01 caml-list:01 ints:01 normalize:01 int:01 int:01 string:02 On 6/13/07, Richard Jones wrote: > I'm getting some odd errors with camlp4 (3.10) and integers. Thanks to Jeremy Yallop for responding to this. I then just add a few bits... > > Firstly, INT returns a string, rather than an int, and similarly > $int:...$ expects a string instead of an int. I can live with this, > but it seems a bit strange, and unless I'm mistaken is different from > what camlp4 <= 3.09 did. Not it's not different and the reason is simple. Camlp4 wants to keep the representation of your integer and turning it to int will normalize it ("42", "4_2", "0000042", "0b0101010"...). With 3.10 you also have active antiquotations $`int:...$ $`int32:...$ for that. Conversely on the parser side you can also get integers instead of string by using real patterns in your production rule. old_prod: [[ s = INT -> (* s is a string *) ... ]]; new_prod: [[ `INT(i, s) -> (* i is an integer and s its representation *) ... ]]; -- Nicolas Pouillard