From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: "Richard Jones" <rich@annexia.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] camlp4 3.10 and ints
Date: Wed, 13 Jun 2007 14:31:57 +0200 [thread overview]
Message-ID: <cd67f63a0706130531v4000f1f2i343df45c4a472ed8@mail.gmail.com> (raw)
In-Reply-To: <20070613114043.GA14594@furbychan.cocan.org>
On 6/13/07, Richard Jones <rich@annexia.org> 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
prev parent reply other threads:[~2007-06-13 12:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-13 11:40 Richard Jones
2007-06-13 12:17 ` [Caml-list] " Jeremy Yallop
2007-06-13 12:31 ` Nicolas Pouillard [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=cd67f63a0706130531v4000f1f2i343df45c4a472ed8@mail.gmail.com \
--to=nicolas.pouillard@gmail.com \
--cc=caml-list@inria.fr \
--cc=rich@annexia.org \
/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