caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: "Gabriel Kerneis" <gabriel.kerneis@enst.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Record types "with" syntax and camlp4
Date: Thu, 22 Feb 2007 10:46:36 +0100	[thread overview]
Message-ID: <cd67f63a0702220146m4408c8afq96380ffe9829c576@mail.gmail.com> (raw)
In-Reply-To: <20070221193433.07f5981b@localhost>

On 2/21/07, Gabriel Kerneis <gabriel.kerneis@enst.fr> wrote:
> Hi,
>
> the { x with y = z} syntax seems to be broken in camlp4. But i can't
> find any information about it in the (deprecated ?) camlp4 manual.
>

Not br0ken, just different. For ambiguity reasons the expression
before "with" needs parentheses.

> 19:29 gabriel % cat record.ml
> type t = { a : int ; b : float } ;
> value x =
>   let s = {a=5 ; b= 1.5} in
>      {s with b = 4.1}  ;

{ (s) with b = 4.1 };

>
> 19:29 gabriel % camlp4rf record.ml
> File "record.ml", line 4, characters 8-12:
> Parse error: [fun_binding] expected after [label_longident] (in
> [label_expr])
> zsh: exit 2     camlp4rf record.ml
>
> Any hint ?

I can also give you a meta-hint for camlp4 stuffs and revised syntax:

$ camlp4o -printer r -str '{ s with foo = bar }'
{ (s) with  foo = bar; };

Camlp4 is a translator itself so if you now how to do some thing in
the original syntax you can learn the revised one by asking to Camlp4
itself.

Of course you can still ask questions on that list...

Regards,

-- 
Nicolas Pouillard


      reply	other threads:[~2007-02-22  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21 18:34 Gabriel Kerneis
2007-02-22  9:46 ` 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=cd67f63a0702220146m4408c8afq96380ffe9829c576@mail.gmail.com \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=gabriel.kerneis@enst.fr \
    /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;
as well as URLs for NNTP newsgroup(s).