caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Record types "with" syntax and camlp4
@ 2007-02-21 18:34 Gabriel Kerneis
  2007-02-22  9:46 ` [Caml-list] " Nicolas Pouillard
  0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Kerneis @ 2007-02-21 18:34 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

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.

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}  ;

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 ?

Thanks a lot,
-- 
Gabriel Kerneis


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Record types "with" syntax and camlp4
  2007-02-21 18:34 Record types "with" syntax and camlp4 Gabriel Kerneis
@ 2007-02-22  9:46 ` Nicolas Pouillard
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Pouillard @ 2007-02-22  9:46 UTC (permalink / raw)
  To: Gabriel Kerneis; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-22  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-21 18:34 Record types "with" syntax and camlp4 Gabriel Kerneis
2007-02-22  9:46 ` [Caml-list] " Nicolas Pouillard

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).