From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from Hermes.metastack.local (172.16.0.8) by Hermes.metastack.local (172.16.0.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Mailbox Transport; Fri, 12 May 2023 15:06:23 +0100 Received: from Hermes.metastack.local (172.16.0.8) by Hermes.metastack.local (172.16.0.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 12 May 2023 15:06:23 +0100 Received: from exchange.romulus.metastack.com (172.16.0.21) by Hermes.metastack.local (172.16.0.8) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.2507.23 via Frontend Transport; Fri, 12 May 2023 15:06:23 +0100 Received: from romulus.metastack.com ([172.16.0.20]) by exchange.romulus.metastack.com (8.14.2/8.14.2) with ESMTP id 34CE5b8s022707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 12 May 2023 15:05:37 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id 34CE5UvT022690 for ; Fri, 12 May 2023 15:05:30 +0100 Received: from prod-listesu18.inria.fr (HELO sympa.inria.fr) ([128.93.162.160]) by mail2-relais-roc.national.inria.fr with ESMTP; 12 May 2023 16:05:31 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id CBC10E0D4E; Fri, 12 May 2023 16:05:29 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 894DFE0D49 for ; Fri, 12 May 2023 16:05:24 +0200 (CEST) Received: from mail1.g3.pair.com ([66.39.3.114]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2023 16:05:23 +0200 Received: from mail1.g3.pair.com (localhost [127.0.0.1]) by mail1.g3.pair.com (Postfix) with ESMTP id 7AE093FB7FD; Fri, 12 May 2023 10:05:20 -0400 (EDT) Received: from Magus.localnet (124.6.138.210.rev.vmobile.jp [210.138.6.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail1.g3.pair.com (Postfix) with ESMTPSA id 734D8582C26; Fri, 12 May 2023 10:05:19 -0400 (EDT) From: Oleg To: "caml-list@inria.fr" Subject: [Caml-list] ANN: BER MetaOCaml N114, for OCaml 4.14.1 Thread-Topic: [Caml-list] ANN: BER MetaOCaml N114, for OCaml 4.14.1 Thread-Index: AQHZhNrvVDaAlhppN0O880ZjhMIciQ== Sender: "caml-list-request@inria.fr" X-MS-Exchange-MessageSentRepresentingType: 2 Date: Fri, 12 May 2023 15:04:53 +0100 Message-ID: Keywords: Sent to dra-news@metastack.com,Marked bulk,MetaStack - Lists,MetaStack List-Help: List-Subscribe: List-Unsubscribe: Reply-To: Oleg Content-Language: en-GB X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: Hermes.metastack.local X-MS-Has-Attach: X-Auto-Response-Suppress: All X-MS-Exchange-Organization-Network-Message-Id: 5f1e25ee-6afa-4ba1-3016-08db52f21175 X-MS-TNEF-Correlator: X-MS-Exchange-Organization-RecordReviewCfmType: 0 x-scanned-by: mailmunge 3.11 on 66.39.3.114 received-spf: None (mail2-relais-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@sympa.inria.fr) identity=helo; client-ip=128.93.162.160; receiver=mail2-relais-roc.national.inria.fr; envelope-from="caml-list-owner@inria.fr"; x-sender="postmaster@sympa.inria.fr"; x-conformance=spf_only x-ironport-av: E=Sophos;i="5.99,269,1677538800"; d="scan'208";a="107709143" x-ironport-anti-spam-filtered: true x-loop: caml-list@inria.fr x-no-archive: yes Content-Type: text/plain; charset="us-ascii" Content-ID: MIME-Version: 1.0 BER MetaOCaml N114 is a strict superset of OCaml 4.14.1 for ``writing programs that generate programs''. BER MetaOCaml adds to OCaml the type of code values (denoting ``program code'', or future-stage computations), and two basic constructs to build them: quoting and splicing. The generated code can be printed, stored in a file -- or compiled and linked-back to the running program, thus implementing run-time code optimization. A subset of the generated OCaml code can also be converted to C, via offshoring. (The generated C needs no particular runtime or GC.) A well-typed BER MetaOCaml program generates only well-scoped and well-typed programs: The generated code shall compile without type errors. Staging-annotation--free BER MetaOCaml is identical to OCaml; BER MetaOCaml can link to any OCaml-compiled library (and vice versa). The main changes in version N114 are -- smoothing the path for the possible future integration into OCaml; -- starting and almost finishing the complete solution to the long-standing CSP problem; -- complete support for offshoring The problems of syntax are said to command the most discussion. This message is no exception. In MetaOCaml, code to be generated is enclosed in brackets: .<1 + 2>. (which may contain `holes', to be filled with code: fun h -> .<1 + .~h>. where .~, analogous to unquotation in Lisp, is called escape). Although `.<' and `.~' are not valid in OCaml and hence can't be confused, `>.' is a a valid OCaml operator (and so are the operators that start with that character sequence, like `>..' and `>.>.'). In fact, there are some libraries that do define the operator `>.' and which therefore cannot be used in MetaOCaml code. Version N114 introduces an adaptive lexer, which treats `>.' identically to ordinary OCaml, until it sees the first `.<'. If one arranges the code such that all occurrences of the operator `>.' come before the opening bracket, one can use the operator even in the same file as brackets. If one cannot arrange code such way, or must use `>.' within brackets, one has to use the alternative syntax for brackets and escapes: fun h -> [%metaocaml.bracket 1 >. [%metaocaml.escape h]] although one may prefer fun h -> [%metaocaml.bracket 1 >. .~h] For more explanations, please see https://okmij.org/ftp/ML/MetaOCaml.html particularly about CSP, and https://okmij.org/ftp/meta-programming/tutorial/genc.html about offshoring. See also ChangeLog and NOTES.txt in the BER MetaOCaml distribution. BER MetaOCaml N114 should be available through OPAM, hopefully soon. In the meanwhile, it is available as a set of patches to the OCaml 4.14.1 distribution. https://okmij.org/ftp/ML/ber-metaocaml.tar.gz See the INSTALL document in that archive. You need the source distribution of OCaml 4.14.1.