From: "Matej Košík" <5764c029b688c1c0d24a2e97cd764f@gmail.com>
To: Markus Mottl <markus.mottl@gmail.com>,
Yaron Minsky <yminsky@janestreet.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] concerning using of `deriving' syntactic plugin
Date: Wed, 07 Mar 2012 17:28:48 +0000 [thread overview]
Message-ID: <4F579AD0.3040702@gmail.com> (raw)
In-Reply-To: <CAP_800pcG+wC9iXMAvY3-4zjO-HdoX+c_Humz3guSrqeG6znTw@mail.gmail.com>
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
next prev parent reply other threads:[~2012-03-07 17:28 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 [this message]
2012-03-07 20:47 ` Till Varoquaux
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=4F579AD0.3040702@gmail.com \
--to=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