From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr 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 D53467FBC6 for ; Fri, 9 Jan 2015 06:34:33 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of oleg@okmij.org) identity=pra; client-ip=66.39.3.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="oleg@okmij.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of oleg@okmij.org designates 66.39.3.115 as permitted sender) identity=mailfrom; client-ip=66.39.3.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="oleg@okmij.org"; 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@www1.g3.pair.com) identity=helo; client-ip=66.39.3.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="postmaster@www1.g3.pair.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkkFABFor1RCJwNzXWdsb2JhbABcgwYiMFiCNrQpAY8SCocMQwEBAQEBBhgHDgZEhQdBEyEdF4hZDaN6oz0BAQgBAQEBHo1shEEMQB2BEwWJYIgYg0+BdgGBDg0jgkGIFoVagiEfgW4gMYJDAQEB X-IPAS-Result: AkkFABFor1RCJwNzXWdsb2JhbABcgwYiMFiCNrQpAY8SCocMQwEBAQEBBhgHDgZEhQdBEyEdF4hZDaN6oz0BAQgBAQEBHo1shEEMQB2BEwWJYIgYg0+BdgGBDg0jgkGIFoVagiEfgW4gMYJDAQEB X-IronPort-AV: E=Sophos;i="5.07,728,1413237600"; d="scan'208";a="95815859" Received: from www1.g3.pair.com ([66.39.3.115]) by mail3-smtp-sop.national.inria.fr with ESMTP; 09 Jan 2015 06:34:32 +0100 Received: by www1.g3.pair.com (Postfix, from userid 9370) id 937C8C382B; Fri, 9 Jan 2015 00:34:30 -0500 (EST) From: oleg@okmij.org To: caml-list@inria.fr Message-Id: <20150109053430.937C8C382B@www1.g3.pair.com> Date: Fri, 9 Jan 2015 00:34:30 -0500 (EST) Subject: [Caml-list] ANN: simplified BER MetaOCaml N102, for OCaml 4.02.1 BER MetaOCaml is a strict superset of OCaml, adding operations to construct and run typed code values. BER MetaOCaml N102 is the new version, which is source _and_ binary compatible with OCaml 4.02.1. That is, staging-annotation-free BER MetaOCaml is identical to OCaml; BER MetaOCaml can link to any OCaml-compiled library (and vice versa); findlib and other tools can be used with BER MetaOCaml as they are, in their binary form. On the surface, BER N102 has hardly changed from the earlier BER N101. All BER N101 code should work with the new version as it was. The users may however notice better printing: of code, error messages and cross-stage-persistent values. The implementation however has changed quite a bit, extensively relying on attributes and bringing MetaOCaml very close to OCaml. It is now a distinct possibility that -- with small hooks that may be provided in the future OCaml versions -- MetaOCaml becomes just a regular library or a plug-in, rather being a fork. (Please see below for details.) The staging annotations are: bracket: .< e >. to delay computation (to the future stage) escape: .~ e to perform a computation e and splice-in the result run: !. e to run a future-stage computation, or code, now A special type constructor, called 'code' builds the type of future-stage computations, or code expressions: # .< 2 + 4 >.;; - : int code = .<2 + 4>. For more details, http://okmij.org/ftp/ML/MetaOCaml.html#using BER MetaOCaml N102 is available: -- as a set of patches to the OCaml 4.02.1 distribution. http://okmij.org/ftp/ML/ber-metaocaml-102.tar.gz See the INSTALL document in that archive. You need the source distribution of OCaml 4.02.1, see the following URL for details. http://ocaml.org/install.html -- as a GIT bundle containing the changes relative to OCaml 4.02.1 http://okmij.org/ftp/ML/metaocaml.bundle First, you have to obtain the base git clone https://github.com/ocaml/ocaml.git -b 4.02.1 ometa4 and then apply the bundle. The older, N101 version, is available via OPAM. The new version will come to OPAM, hopefully soon. Although on the surface BER N102 is almost the same as the earlier version, internally it is quite different. To give the idea of the difference, it is instructive to compare the amount of changes BER MetaOCaml makes to the OCaml distribution. The old BER N102 modified 32 OCaml files. The new BER N102 modifies only 7 (that number could be further reduced to only 2; the only file with nontrivial modifications is typecore.ml). The patch size was 49729 bytes before and 34066 bytes now. The principal change is the extensive use of attributes, the new feature of OCaml 4.02. Staging annotations -- brackets, escapes and CSP -- are now really annotations: attributes on the Parsetree and Typedtree. MetaOCaml also uses a Typedtree attribute to mark non-expansive nodes (the non-expansiveness check is performed before the bracket-translation but is used only after). An attribute on value_description tells the staging level of the value. There is no longer a separate Typedtree traversal pass, after the type checking, to translate brackets and escapes. That means that for staging-annotation-free code, MetaOCaml has no substantial overhead. BER N102 has started on revamping cross-stage-persistence; quite a few CSP have become printable and, mainly, serializable. Non-serializable CSP were the only impediment to native MetaOCaml. For more explanations, please see http://okmij.org/ftp/ML/MetaOCaml.html as well as ChangeLog and NOTES.txt in the BER MetaOCaml distribution. Hopefully the release of BER MetaOCaml N102 would further stimulate using and researching typed meta-programming -- and perhaps merging of MetaOCaml into the mainstream OCaml.