From mboxrd@z Thu Jan 1 00:00:00 1970 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 q27Gi961007060 for ; Wed, 7 Mar 2012 17:44:09 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsYOAL6PV09KfVM2kGdsb2JhbABCgi8EY4IrrlUCAoEGCCIBAQEBCQkNBxQEI4IKAQEBBBICDx0BGx0BAwwGBQsDCgICBSECAg8CEhEBBQEcBg0BBwEBHodmBAehUAqLKEyCcYVAP4EMAQEEC4EkiRcqgSmDQIEWBJVBhWSBOocbPYQE X-IronPort-AV: E=Sophos;i="4.73,545,1325458800"; d="scan'208";a="148080575" Received: from mail-ee0-f54.google.com ([74.125.83.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Mar 2012 17:44:07 +0100 Received: by mail-ee0-f54.google.com with SMTP id d17so2833820eek.27 for ; Wed, 07 Mar 2012 08:44:08 -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=KoYqYvAgq5yhqUBxAgYES030vOGVjy/MlYA7jFBFZmI=; b=Nk2c1FhXKntRFpO8RTQJCuJJAu8MaKbQ49lj7ra+MiCM9qP5DooIZbTZSS7dzOu04Z eMZjVLukMbMnOPMG2TDAxHSMz2fRD7kNUPx6tgReHC3fVmeM5rDClBqD3UI1odulhVmM E1BCUzlPDilkmPJCo/cJ4U1gFjj/RdoxHPVXpqraDi6nKvbD5cFntriFIQJpMrJJroPf V4cxfsSmlYA6HUW8RqkOTALGl/kFaqrEfonAio3WsHy65Z4fdO+2T+sF+OtcPzqWU0vV WS3R8XHyY4A0hHx+B/QLFhmse+iBiopGUM2Zet2zNcMfwlX9zVKzm6V0kd0b/U8tZhND 9Z1w== Received: by 10.112.26.168 with SMTP id m8mr908379lbg.100.1331138647859; Wed, 07 Mar 2012 08:44:07 -0800 (PST) Received: from [172.27.6.206] ([213.106.240.92]) by mx.google.com with ESMTPS id k10sm34241304lbu.1.2012.03.07.08.44.06 (version=SSLv3 cipher=OTHER); Wed, 07 Mar 2012 08:44:06 -0800 (PST) Message-ID: <4F579054.60203@gmail.com> Date: Wed, 07 Mar 2012 16:44:04 +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: Yaron Minsky CC: Caml List References: <4F574B3C.5000207@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] concerning using of `deriving' syntactic plugin On 03/07/2012 12:34 PM, Yaron Minsky wrote: > Are you familiar with type-conv and the family of syntax-extensions that > go along with it? You can do thinks like: > > type t = { foo: int; bar: string } > with sexp, compare, bin_io > > > and automatically get sexp-conversion functions, a comparison function, > and binary protocol converters. And type-conv has been used to build > other type-directed functions by other people outside of Jane Street. > > The latest version is available on bitbucket, and we'll have a new > blessed release in a few days. > > https://bitbucket.org/yminsky/ocaml-core/ > > > Note that this is done purely syntactically, and yet gets you there. I have looked at bin_prot and sexplib previously. They are very nice and useful. 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.