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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id D7E027F6D8 for ; Mon, 19 Jan 2015 08:33:05 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of oleg@okmij.org) identity=pra; client-ip=66.39.3.115; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="oleg@okmij.org"; x-sender="oleg@okmij.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.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=mail2-smtp-roc.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 (mail2-smtp-roc.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=mail2-smtp-roc.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: AsUAALuyvFRCJwNzemdsb2JhbABbhmXJbgKBHEMBAQEBAREBAQsHDQlChA0BBAF+FiETIR0rB4g2CM8LAQEBBwEBAQEekACDFoETBYl1jXoBihqIEIQuIIJ0AQEB X-IPAS-Result: AsUAALuyvFRCJwNzemdsb2JhbABbhmXJbgKBHEMBAQEBAREBAQsHDQlChA0BBAF+FiETIR0rB4g2CM8LAQEBBwEBAQEekACDFoETBYl1jXoBihqIEIQuIIJ0AQEB X-IronPort-AV: E=Sophos;i="5.09,425,1418079600"; d="scan'208";a="117555096" Received: from www1.g3.pair.com ([66.39.3.115]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 19 Jan 2015 08:33:04 +0100 Received: by www1.g3.pair.com (Postfix, from userid 9370) id 038ECC38BA; Mon, 19 Jan 2015 02:33:03 -0500 (EST) From: oleg@okmij.org To: jun.furuse@gmail.com, caml-list@inria.fr In-reply-to: Message-Id: <20150119073303.038ECC38BA@www1.g3.pair.com> Date: Mon, 19 Jan 2015 02:33:03 -0500 (EST) Subject: Re: [Caml-list] [ANN] ppx_monadic.1.0.2, ppx for monadic do, > Current OCaml syntax has shortage of pattern binding expression and > only usable is let%xxx p = e in which is a bit pain for ppx writers. Indeed. One may wish that let rec p = e1 in e2 were treated as if it were let[@ocaml.let "rec"] p = e1 in e2 and likewise let module. Come to think of it, 'rec! or 'module' are annotations on let. Then we can generalize so that let something p = e1 in e2 (where something is any reserved word or an operator -- something that cannot be mistaken for a regular identifier) is parsed as if it were let[@ocaml.let "something"] p = e1 in e2 The type-checker will complain if it finds the ocaml.let attribute it does not understand. (Therefore, Typedtree does not have to be changed -- although one may wish for a specifically letrec node). Thus we can define let !, let >>=, let LWP, let struct, let when, let if and all other potentially useful binding forms.