From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q27HSvbV009303 for ; Wed, 7 Mar 2012 18:28:57 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuMPAN+ZV0/RVdY2kGdsb2JhbABEgiAEZYIrrlYCAoEGCCIBAQEBCQkNBxQEI4IKAQEBAwESAg8PAQ0BGxwBAQMBCwYDAgsNAgIFFgsCAgkDAgECAQ8CEQEFARwGAQwBBQIBAR6HYQUEm3QKiyhMgnGFPT+IdAEFC4EkiAqBN4Epg0CBFgSVQYVkgTqEA4MYPYQE X-IronPort-AV: E=Sophos;i="4.73,545,1325458800"; d="scan'208";a="134891450" Received: from mail-bk0-f54.google.com ([209.85.214.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Mar 2012 18:28:51 +0100 Received: by bkcjc3 with SMTP id jc3so9957592bkc.27 for ; Wed, 07 Mar 2012 09:28:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=kF7VV0/xkHmic4/l8EDs/UQxVzYUdsfNQxwOckigqp4=; b=NiXdvIqjwiBI7S9qWd+I+v2s/ASy1kPpxB/mlptVhBxAKFNXmn7JhpEA4Uq082p0l7 R6BivnvB/me9plCTnsGGJ3W7HTWvW0c8fBwXF5hA/mKRKLMldMb9t69ItsSEbKJ+X4Ys fPdU+FJSUIOavQqjGHhAov020HZUmdYoeurROjE/VDtKRaEUQCx7wKrDPQHYmOtog/UZ smjCr/L1LIvI6J9nG9v2idzKjdWZ45idf1Ldf+KpNjMuyPNdPLr5T5MnSCIKsWWUJe5n QxlTV+7Ym2MJI1DMFhOSt8TRsWZXwfc0+zjITD8QHOuIcRJ4joov8FIEAk5Do5W0R56F 0SOA== Received: by 10.204.129.13 with SMTP id m13mr1317283bks.119.1331141330780; Wed, 07 Mar 2012 09:28:50 -0800 (PST) Received: from [172.27.6.206] ([213.106.240.92]) by mx.google.com with ESMTPS id t17sm40250425bke.6.2012.03.07.09.28.49 (version=SSLv3 cipher=OTHER); Wed, 07 Mar 2012 09:28:49 -0800 (PST) Message-ID: <4F579AD0.3040702@gmail.com> Date: Wed, 07 Mar 2012 17:28:48 +0000 From: =?UTF-8?B?TWF0ZWogS2/FocOtaw==?= <5764c029b688c1c0d24a2e97cd764f@gmail.com> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: Markus Mottl , Yaron Minsky CC: Caml List References: <4F574B3C.5000207@gmail.com> <4F579054.60203@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] concerning using of `deriving' syntactic plugin 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