Version française
Home     About     Download     Resources     Contact us    
Browse thread
Polymorphic map and OO syntax extension
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin_jambon@e...>
Subject: Re: [Caml-list] OO syntax extension
On Fri, 15 Jul 2005, Marc Lasson wrote:

> Jacques Garrigue wrote:
>
> >OO syntax extension
> >    Some camlp4 syntax extensions to write more compact code using
> >    objects. The new syntaxes are
> >        * val [mutable] x = expr with (reader|writer|accessor)
> >          generates code for an x and a set_x method, like in ruby.
> >        * obj#x <- expr
> >          generates a call to the set_x method.
> >        * {| [mutable] f1 = expr1; ...; [mutable] fn = exprn |}
> >          generates an immediate object with the above fields and the
> >          corresponding accessor methods. You may also include inherit
> >          declarations.
> >
> I am very interested in your OO syntax extension but i did not succeed
> to compile it.
> I get the following error:
>
> marc@georgie:~$ ocamlc -I +camlp4 -c -pp 'camlp4o pa_extend.cmo
> q_MLast.cmo' pa_oo.ml
> File "pa_oo.ml", line 12, characters -249--249:
> Unbound value loc
>
> The error's position looks very weird. Since i can't speak camlp4, i'm
> unable to fix it.

Pass the -loc _loc option to camlp4o and it should work.
See http://martin.jambon.free.fr/extend-ocaml-syntax.html#loc


Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr