From: Till Varoquaux <till@pps.jussieu.fr>
To: "Matej Košík" <5764c029b688c1c0d24a2e97cd764f@gmail.com>
Cc: Markus Mottl <markus.mottl@gmail.com>,
Yaron Minsky <yminsky@janestreet.com>,
Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] concerning using of `deriving' syntactic plugin
Date: Wed, 7 Mar 2012 15:47:46 -0500 [thread overview]
Message-ID: <CAHJESt16558J=YAh-OY9VV90DBKqkD0TSo8qzAwLb=Oo_5dArQ@mail.gmail.com> (raw)
In-Reply-To: <4F579AD0.3040702@gmail.com>
You are the wrong version of camlp4 (the different campl4 binaries
load different libraries, syntaxes etc...). If you switch camlp4orf to
camlp4o your code should compile fine. Also note that I would
recommend using the excellent ocamlfind tool:
ocamlfind c -linkpkg -package sexplib,sexplib.syntax -syntax camlp4o main.ml
Till
On Wed, Mar 7, 2012 at 12:28 PM, Matej Košík
<5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote:
> Hi Markus,
>
> On 03/07/2012 05:10 PM, Markus Mottl wrote:
>> On Wed, Mar 7, 2012 at 11:44, Matej Košík
>> <5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote:
>>> I have found one (I guess unnecessary) disadvantage over `deriving'.
>>> If you process your *.ml file with sexplib/bin_prot preprocessor, you
>>> have to append "with ..." suffix to every type definition, otherwise you
>>> will get a an error report from the preprocessor. `Deriving' does not
>>> force you to do that. You can annotate only those type definitions,
>>> which for you makes sense to annotate.
>>
>> I'm not sure what the perceived problem is, but there should be no
>> need to annotate all type definitions. It should suffice to annotate
>> those for which converters are needed.
>
> The following artificial example:
>
> open Sexplib.Conv
> type foo = int * int with sexp
> type bar = float * float with sexp
>
> is compilable
>
> (e.g.:
> ocamlc -o main -pp "camlp4of -I
> /home/mkosik/lib/godi/lib/ocaml/std-lib/../pkg-lib/sexplib -I
> /home/mkosik/lib/godi/lib/ocaml/std-lib/../pkg-lib/type-conv
> pa_type_conv.cma pa_sexp_conv.cma" -I
> /home/mkosik/lib/godi/lib/ocaml/std-lib/../pkg-lib/sexplib -I
> /home/mkosik/lib/godi/lib/ocaml/std-lib/../pkg-lib/type-conv unix.cma
> nums.cma bigarray.cma sexplib.cma main.ml
> )
>
> If you remove any of the "with sexp" clauses, you will get a
> preprocessor error:
>
> File "main.ml", line 4, characters 18-23:
> Parse error: "with" expected after [type_declaration] (in [str_item])
> File "main.ml", line 1, characters 0-1:
>
> This is at least what I am experiencing.
>
>> This, of course, means that
>> any types that a type definition is referring to will also need
>> annotations (or hand-written conversion functions).
>
> Regards,
>
> Matej Kosik
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
next prev parent reply other threads:[~2012-03-07 20:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-07 11:49 Matej Košík
2012-03-07 12:31 ` Gabriel Scherer
2012-03-07 16:44 ` Matej Košík
2012-03-07 17:06 ` Jérémie Dimino
2012-03-07 12:34 ` Yaron Minsky
2012-03-07 16:44 ` Matej Košík
2012-03-07 17:10 ` Markus Mottl
2012-03-07 17:28 ` Matej Košík
2012-03-07 20:47 ` Till Varoquaux [this message]
2012-03-08 2:49 ` Markus Mottl
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='CAHJESt16558J=YAh-OY9VV90DBKqkD0TSo8qzAwLb=Oo_5dArQ@mail.gmail.com' \
--to=till@pps.jussieu.fr \
--cc=5764c029b688c1c0d24a2e97cd764f@gmail.com \
--cc=caml-list@inria.fr \
--cc=markus.mottl@gmail.com \
--cc=yminsky@janestreet.com \
/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