From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 1E0567FC6C for ; Mon, 5 Oct 2015 15:41:03 +0200 (CEST) IronPort-PHdr: 9a23:hu8vohStuD1OLXld0reuY5K3Ttpsv+yvbD5Q0YIujvd0So/mwa65ZhGN2/xhgRfzUJnB7Loc0qyN4/ymBzxLv8zJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbvip9uNM04W3nKUWvBbElaflU3prM4YgI9veO4a6yDihT92QdlQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGfayQ6NtB7tTBTEidmsy/sDDuh7EQg+C6WEbT30N1BFPBkKNuBbxV5L19yD9rOdV1y6dMsn7QqozRCy5qaxsTUmswG0MPjs9tWXWkdBYjaRBoRvnqQY1i9rfaYSRcf5/Zb/1fNUARGMHUNwHBAJbBYbpTYYVAu8AMK50roz8oVxG+RmyBAytAuTHyDZOi2Tqx6A3z6IqFgSQj19oJM4HrHmB9Ia9D6wVS+3glKQ= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jdimino@janestreet.com; spf=Pass smtp.mailfrom=jdimino@janestreet.com; spf=None smtp.helo=postmaster@mxout4.mail.janestreet.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.233; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.233 as permitted sender) identity=mailfrom; client-ip=38.105.200.233; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mxout4.mail.janestreet.com) identity=helo; client-ip=38.105.200.233; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@mxout4.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0APAgCPfBJWnOnIaSZeg3tuBr90GYcsBzwQAQEBAQEBAQEQAQEBAQEGFglPgh2CIBEdAQE4JQ8CJgIkEgEFASIBGhqIDAOaF4EwPjGKWHGEZQEFjxUBCgEBARgGCoEYhVGMe4FDjQqId4UXiACCHYwxi0kSI4EXOII8FgeBVXCIPwEBAQ X-IPAS-Result: A0APAgCPfBJWnOnIaSZeg3tuBr90GYcsBzwQAQEBAQEBAQEQAQEBAQEGFglPgh2CIBEdAQE4JQ8CJgIkEgEFASIBGhqIDAOaF4EwPjGKWHGEZQEFjxUBCgEBARgGCoEYhVGMe4FDjQqId4UXiACCHYwxi0kSI4EXOII8FgeBVXCIPwEBAQ X-IronPort-AV: E=Sophos;i="5.17,638,1437429600"; d="scan'208";a="149677378" Received: from mxout4.mail.janestreet.com ([38.105.200.233]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Oct 2015 15:41:02 +0200 Received: from tot-qpr-mailcore2.delacy.com ([172.27.56.106] helo=tot-qpr-mailcore2) by mxout4.mail.janestreet.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1Zj60i-0007Uw-Ii for caml-list@inria.fr; Mon, 05 Oct 2015 09:41:00 -0400 X-JS-Flow: external Received: by tot-qpr-mailcore2 with JS-mailcore (0.1) (envelope-from ) id BWEn3r-AAAAub-MS; 2015-10-05 09:40:59.393768-04:00 Received: from mail-io0-f172.google.com ([209.85.223.172]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1Zj60h-000768-A1 for caml-list@inria.fr; Mon, 05 Oct 2015 09:40:59 -0400 Received: by ioii196 with SMTP id i196so185088148ioi.3 for ; Mon, 05 Oct 2015 06:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:date:message-id:subject:from:to:content-type; bh=yMYAIUMx1Gu2r8Fw5i56WrlahFEhq1ttrKcxnBZsqbQ=; b=Qqqu6s12OdQjG+dlSvyjW27CokeFDB2kb7/Z2+mhEx8qNendyIe6rka/Ba+6MGtGWo BW99mUYd7Ur/AmCpphwghaU866HS28abVneAwY2KJ5JguhHfQNSO8yRF2KFq00nHaG2R J2HLMxRgueD0EzaoCnvAqUT2hHCi6BjRed67g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=yMYAIUMx1Gu2r8Fw5i56WrlahFEhq1ttrKcxnBZsqbQ=; b=bmo90Nf9VxbJn6SBC28+qB0YAoBu3P67tBvRqXuHNL5G3drrX/36GZjQ8OTm34YIL7 5z7RuUWlsFjhxtfrzH4du/jskhKKl9ulSe8Iq4cZP0p+++r7MYQqFX5CZCNH4BMRkmMZ FR3AKxr4+vMx0AL6dRZ7jL4Ax1So3vLl+PeVSYPZ3D95AFuP8Cy5z9HPTpmaLowQ53Y0 afref9/NR41QmERllD9J855jVDLMMmzC2F4Gc3BKmE7Kc20U8ffSWjL64QnITNIdi5Yn wYV2RJCOiJroz2D96gRKFYRM5LbZzBo37qrBz9vh4QFwSts+LiB2He6aBZMrshi8KBbG ZPmw== X-Gm-Message-State: ALoCoQnXaslO9afnkKTBcahuXfi5P7svvsCPkPNAk5I1MNcMQCFvUrCe+B5mMZqnEtIKH5PrXqK82/9Rj1Mi2TAEQe5rqdoN7/abU9PigzvRcqB1ylQ+6Iz4umzsWktddVp5dVk4Xkoc X-Received: by 10.107.46.158 with SMTP id u30mr33628848iou.56.1444052458937; Mon, 05 Oct 2015 06:40:58 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.46.158 with SMTP id u30mr33628825iou.56.1444052458717; Mon, 05 Oct 2015 06:40:58 -0700 (PDT) Received: by 10.50.237.70 with HTTP; Mon, 5 Oct 2015 06:40:58 -0700 (PDT) Date: Mon, 5 Oct 2015 14:40:58 +0100 Message-ID: From:Jeremie Dimino To:"ocaml-core@googlegroups.com" , "caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 X-JS-Processed-by: mailcore Subject: [Caml-list] [ANN] Jane Street's ppx rewriters I am pleased to announce the initial release of the Jane Street's ppx rewirters. They are now all in opam, and the next release of Core will be using them. They are using a specific framework that we developed to ensure our rewriters are robust against misuses of new syntaxes. However all packages export regular ppx executables or ppx_deriving plugins, than can be used the standard way with ocamlfind. This is the list of ppx rewriters that we released so far: - ppx_assert (replaces pa_test) - ppx_bench - ppx_bin_prot - ppx_compare - ppx_csv_conv - ppx_custom_printf - ppx_enumerate - ppx_fail - ppx_fields_conv - ppx_here - ppx_inline_test (replaces pa_ounit) - ppx_pipebang - ppx_sexp_conv - ppx_sexp_value (replaces pa_structural_sexp) - ppx_typerep_conv - ppx_variants_conv - ppx_xml_conv In addition we are releasing a few libraries: # ppx_core This is our PPX standard library. Amongst other things it contains: - Various open recursion classes to traverse the OCaml AST: Ast_traverse.{map,fold,fold_map,...}. This work extends the Ast_mapper.mapper record of the OCaml compiler libraries. However it uses names that are closer to the ones in parsetree.mli, so that is is easier to infer them by just knowing the parsetree. We found that was helpful when writing ppx related code. - A framework for attributes and extension points. It deals with namespacing and make it easier to describe the expected payload. When used in combination with ppx_driver, it provides helpful error messages for users. - Helpers for building and matching the OCaml AST. The building part is similar to the Ast_helper module of OCaml but with a different naming convention and no use of a global variable: a functor is provided to factorize the [~loc] argument. # ppx_driver This is what we use to handle all of our code rewriting. Instead of running one process per code transformation, we crunch them all into one executable. This has several advantages: - probably speed, although this hasn't been benchmarked - a simple way to see the transformed code: no need to build a complex command line, just run "./ppx file.ml" - some helpers to debug code transformations But more importantly, since the driver has knowledge of all transformations and all supported attributes and extensions, it can: - check that no attribute accidentally ends up being dead code - give helpful error messages for unused attributes For instance: # type t = int [@@derivin sexp] Attribute `derivin' was not used Hint: Did you mean deriving? # type t = int [@deriving sexp] Attribute `deriving' was not used Hint: `deriving' is available for type declarations, type extensions and extension constructors but is used here in the context of a core type. Did you put it at the wrong level?" # type t = { x : int [@default 42] } [@@deriving sexp_of];; Attribute `default' was not used # let%test ("name" [@foo]) = f x = 42;; Attributes not allowed here This is important to us as we don't want people to waste time because of a misspelled/misplaced attribute. Also when developing rewriters, we found that it was quite easy to accidentally drop attributes, and sometimes it is hard to avoid. ppx_driver notifies the user when this happens. # ppx_type_conv This is the base library for all our type-driven code generators. It is similar to ppx_deriving, but with similar requirements as ppx_driver. Unless used with ppx_driver, ppx_type_conv will just use ppx_deriving. # ppx_optcomp This is what we use for when we need conditional compilation. It's has a cpp-like syntax, which is nice for this kind of things, and works at the lexer level, which make it possible to use it in pattern matchings for instance. It is used by the lexer fronted of ppx_driver. So if used as a -pp instead of -ppx, a ppx driver will have optcomp enabled. -- Jeremie Dimino, for the Core team