From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 28CE47ED11 for ; Mon, 3 Oct 2016 09:02:32 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=louis.gesbert@ocamlpro.com; spf=None smtp.mailfrom=louis.gesbert@ocamlpro.com; spf=None smtp.helo=postmaster@vps119294.ovh.net Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of louis.gesbert@ocamlpro.com) identity=pra; client-ip=37.187.244.36; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="louis.gesbert@ocamlpro.com"; x-sender="louis.gesbert@ocamlpro.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of louis.gesbert@ocamlpro.com) identity=mailfrom; client-ip=37.187.244.36; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="louis.gesbert@ocamlpro.com"; x-sender="louis.gesbert@ocamlpro.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@vps119294.ovh.net) identity=helo; client-ip=37.187.244.36; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="louis.gesbert@ocamlpro.com"; x-sender="postmaster@vps119294.ovh.net"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3ApV2xTh8ol8LCnv9uRHKM819IXTAuvvDOBiVQ1KB9?= =?us-ascii?q?1+ocTK2v8tzYMVDF4r011RmSDN+dsa4P0rOP++C4ACpbvsbH6ChDOLV3FDY7yu?= =?us-ascii?q?wu1zQ6B8CEDUCpZNXLVAcdWPp4aVl+4nugOlJUEsutL3fbo3m18CJAUk6nbVk9?= =?us-ascii?q?Dq3PF4XTl8W60fyps92WOl0QxWn1XbQnJxyzqUDVt9IKqYpkMKc4jBXT5jNtcu?= =?us-ascii?q?BdwmdtbXeagx/45c74qJtm+jhZv/Eo38FFWKT+Oa8/SOoLIi4hNjUR49DqrlHs?= =?us-ascii?q?QBCF62EAGjESlQdJGE7K4QrwU43tmizxv+95wDOde8bxSOZnCnyZ8653RUqw22?= =?us-ascii?q?88PDkj/TSS05QogQ=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0C2CwA/AvJX/yT0uyVdHgYMGBgHgwYBA?= =?us-ascii?q?QEBAXUTAzUxhSafCot0ghKIIxyGAgIIgg8QAQEBAQEBAQEBAQFdJ4IyBAEVAQS?= =?us-ascii?q?CEQEBBCcTTwsYCRUQDwFHBgGIY7wDhjiEVYREY4R7AQSZeIFlhEKMBochhhWMb?= =?us-ascii?q?oN+NR+FDjw0hmuBQQEBAQ?= X-IPAS-Result: =?us-ascii?q?A0C2CwA/AvJX/yT0uyVdHgYMGBgHgwYBAQEBAXUTAzUxhSa?= =?us-ascii?q?fCot0ghKIIxyGAgIIgg8QAQEBAQEBAQEBAQFdJ4IyBAEVAQSCEQEBBCcTTwsYC?= =?us-ascii?q?RUQDwFHBgGIY7wDhjiEVYREY4R7AQSZeIFlhEKMBochhhWMboN+NR+FDjw0hmu?= =?us-ascii?q?BQQEBAQ?= X-IronPort-AV: E=Sophos;i="5.31,288,1473112800"; d="scan'208";a="239115800" Received: from antislash.info (HELO vps119294.ovh.net) ([37.187.244.36]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2016 09:02:31 +0200 From: Louis Gesbert To: caml-list@inria.fr, Malcolm Matalka Date: Mon, 03 Oct 2016 09:02:25 +0200 Message-ID: <8387589.2ddTWeEJPz@maitake> In-Reply-To: <86zin96l8z.fsf@gmail.com> References: <86zin96l8z.fsf@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Validation-by: meta@antislash.info Subject: Re: [Caml-list] ocp-indent begin/end behaviour? On jeudi 15 septembre 2016 19:01:00 CEST Malcolm Matalka wrote: > I have the following code that I'm using ocp-indent to indent: > > let () = > match Random.int 10 with > > | 1 -> begin > > zoom (); > baz () > end > > | 2 -> > > () > > The zoom and baz are indented "double", and I cannot figure out how to > undo that. I'd like the begin/end to have no effect on indentation at > all. Is this a bug or am I doing something wrong? > > /Malcolm ocp-indent is all about compromises and trying to keep programs visually consistent. Also, it attempts to keep the configuration options to a minimum so that their effects can still be easily understood, and styles don't diverge too much. In this case, `zoom (); baz ()` is inside two scopes that can be closed individually (`->` and `begin/end`). So, as Goswin pointed out, without that extra indentation the `end` would have to be either at the level of the `|` or that of `zoom ();`, which isn't totally accurate, and in either case, if you were to add `; some more stuff` after `end`, you couldn't get a proper indentation without backtracking anymore. So it's not a bug, but a design choice -- it's impossible to satisfy everyone anyway (-- or it would end up like LaTeX). Note that it's designed to play well with interactive use + partially manual indent (e.g. if you move `zoom ();`, `baz ()` will follow) Best, Louis Gesbert -- OCamlPro