From mboxrd@z Thu Jan 1 00:00:00 1970 X-Sympa-To: caml-list@inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q27KlnVu013202 for ; Wed, 7 Mar 2012 21:47:49 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqACADbIV0/RVdU2kWdsb2JhbABEhTSeE5FXCCIBAQEBCQsLBxQEI4IKAQEBBBICDx0BLQsBAwwBBQMCCw0CAgkdAgIhARIBBQEKEgYTEhCHZgucBQqLKIM9hTaJMwEFC4EkiAqGIIEWBIhSjG+HcIMxgxg9gVSCTg X-IronPort-AV: E=Sophos;i="4.73,547,1325458800"; d="scan'208";a="148119691" Received: from mail-yw0-f54.google.com ([209.85.213.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Mar 2012 21:47:47 +0100 Received: by yhgm50 with SMTP id m50so4494125yhg.27 for ; Wed, 07 Mar 2012 12:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qZm3uz9wx6HhsxiFOtu6OwFYv41EtqF76ipysXgJ50k=; b=sbGBlrUsJuzfK1l2UUOTAiSrsaK9eOwewEQTt9hIaubYsC/oIZ+xIM8S7VakXdGvMk pPMpCs5adOwKIt3tWEfY9SZXsphQBabStZS6JNvNcsqUWVlJNWXXtyzeEkrxkBegX5kO 6wG6QcnQ5I/XRiusGZUph5xO3Aj5jdoxzvXRUV4wR8YaCHu6Qeo5bYZd7h6XNbDszazd XgZs+bq/70wl3GZAn8gA7v2w3rwcodUXmzsEbb7K8kOVKFpH+tXYYZ52ovI7HFWfIPiO MjJlEPpM1IB0cF7tGsE6EpqHqChSEnCXnKE/fqhVHa46CouC6NLYCbs/YEDdbFPmnh5/ uTtg== MIME-Version: 1.0 Received: by 10.60.9.232 with SMTP id d8mr1389361oeb.66.1331153266585; Wed, 07 Mar 2012 12:47:46 -0800 (PST) Sender: till.varoquaux@gmail.com Received: by 10.182.66.233 with HTTP; Wed, 7 Mar 2012 12:47:46 -0800 (PST) In-Reply-To: <4F579AD0.3040702@gmail.com> References: <4F574B3C.5000207@gmail.com> <4F579054.60203@gmail.com> <4F579AD0.3040702@gmail.com> Date: Wed, 7 Mar 2012 15:47:46 -0500 X-Google-Sender-Auth: TMHoFPzm_6QDpjspoDtuLFW1yzM Message-ID: From: Till Varoquaux To: =?UTF-8?B?TWF0ZWogS2/FocOtaw==?= <5764c029b688c1c0d24a2e97cd764f@gmail.com> Cc: Markus Mottl , Yaron Minsky , Caml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q27KlnVu013202 X-Validation-by: till@pps.jussieu.fr Subject: Re: [Caml-list] concerning using of `deriving' syntactic plugin 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 >