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 42E717F615 for ; Mon, 19 Dec 2016 19:21:03 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-io0-f175.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.223.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.223.175 as permitted sender) identity=mailfrom; client-ip=209.85.223.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; 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@mail-io0-f175.google.com) identity=helo; client-ip=209.85.223.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-io0-f175.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AJq/+9xakY4xy9OEEykqLWKL/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpc2/bnLW6fgltlLVR4KTs6sC0LuN9f+/EjVZu97B6ClEK8McEUddyI?= =?us-ascii?q?0/pE8JPo2sMQXDNvnkbig3ToxpdWRO2DWFC3VTA9v0fFbIo3e/vnY4ExT7Mhdp?= =?us-ascii?q?dKyuQtaBx+z+7e25+oXSbgNUn3L9JOoqdFTl5TnW4+gIiI0qBaEtzQXConpUYK?= =?us-ascii?q?wCxH1nDVOekhu64d2/qs1N6SNV7t0o/dRBXKGyRK84QKZVFnxyPGk//szmsV/Y?= =?us-ascii?q?RguC/HYGemoTmxtMRQPC6UepDd/KriLmu78li2GhNsrsQOVxAGz64g=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AtAADRI1hYhq/fVdFDGhoBAQEBAgEBA?= =?us-ascii?q?QEIAQEBARYBAQEDAQEBCQEBAYMMAQEBAQF5gQYHjUiWWYhmjCiCCiqFeAKBewc?= =?us-ascii?q?/FAEBAQEBAQEBAQEBEgEBAQgLCwkdMIIzBAEVAQSCFwEFIwQZARsdAQMMBgULA?= =?us-ascii?q?woCAiYCAiIBEQEFARwGEwgTiDUBAxcOLps7P4wCgWwYBQEegw0Fg1IKGScNVIJ?= =?us-ascii?q?8AQEBAQEFAQEBAQEbAgEFEnmFK4RZgwOEQYJdBY9+hHCGAoF6hFiKYotQhH2OG?= =?us-ascii?q?YJJFB6BFB91RE4TgzsgggYgNAGHOoFPAQEB?= X-IPAS-Result: =?us-ascii?q?A0AtAADRI1hYhq/fVdFDGhoBAQEBAgEBAQEIAQEBARYBAQE?= =?us-ascii?q?DAQEBCQEBAYMMAQEBAQF5gQYHjUiWWYhmjCiCCiqFeAKBewc/FAEBAQEBAQEBA?= =?us-ascii?q?QEBEgEBAQgLCwkdMIIzBAEVAQSCFwEFIwQZARsdAQMMBgULAwoCAiYCAiIBEQE?= =?us-ascii?q?FARwGEwgTiDUBAxcOLps7P4wCgWwYBQEegw0Fg1IKGScNVIJ8AQEBAQEFAQEBA?= =?us-ascii?q?QEbAgEFEnmFK4RZgwOEQYJdBY9+hHCGAoF6hFiKYotQhH2OGYJJFB6BFB91RE4?= =?us-ascii?q?TgzsgggYgNAGHOoFPAQEB?= X-IronPort-AV: E=Sophos;i="5.33,374,1477954800"; d="scan'208";a="250741144" Received: from mail-io0-f175.google.com ([209.85.223.175]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 19 Dec 2016 19:21:02 +0100 Received: by mail-io0-f175.google.com with SMTP id h30so159294567iod.2; Mon, 19 Dec 2016 10:21:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pNva4M0aomLXew82gNrCvtUAFm0ukgulEq3SjsXc5Ag=; b=OeFq1Zh+EvLSg0iB1BuW6N9S1GF32SPtLgtOe4e5d59sx1FTs8YYDwJfArkBOiEogf pw3j6AN0Pqw1ncDAXr6AbmmfkKrdnTfb36nCg+16E6H4eSV/xz36mC+Ad1SmWH/1OLIW pmoFCpCKqkUnP1nrszNebhlyddIyaUQyDYqcJ49hfWrOK7JG4Zd+N4cbC7ONS85/hgf7 Hf33yMMJtDx0jg+QWTrXN837RiEwBKcGS0ixZW3E8Il0RZl9KsUyv6ZjGzuMlSFCR5Sq hasFI452sZPmI0MPc0N09RXU/bkRKc56oQ3gkAqtoh0brLw3wtoV33LyspDBp4qVyu7K eENQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pNva4M0aomLXew82gNrCvtUAFm0ukgulEq3SjsXc5Ag=; b=ZxKSkPy7JrQ0PRFTXI8bRHdqF3Z21yB+Rgg9u6EeW+p9W0ilMun+buTP3pDcogyf8U x7DYyf490D5lJVc65SXF+BVY0IUEvuAjnHYqTVroCFuiFhpWyOkfFcc5qWNzC14X0XWm s1pg/B8NcAV8bRntD3EFN8nHk0/q41Cc7G9PAQx5PXOU1XXcXMypPsVBYKfUg19Px2oz Xl+6qVf5NP9hd0fNKNiDq0FCybRW5VB0pGIpNQH85SAdhaJ/IDSxK+R1yB/nDn80WXO4 4lAY1/qC4pzS0MfqS0kXp68n7v0ZiE0tM7ejQHPTCoOvgQ4whjy8q2b3CdiD2y4YkXNP hzQA== X-Gm-Message-State: AIkVDXIfD9t/nflmEHdRBEhVsqoiTxg07PvHl0DWB9ef/sE0aZlZ5M8d/Sl4lmufPY0oQe5gLzk9p4muFqRHXA== X-Received: by 10.107.2.210 with SMTP id 201mr15306546ioc.67.1482171660639; Mon, 19 Dec 2016 10:21:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.140.146 with HTTP; Mon, 19 Dec 2016 10:20:20 -0800 (PST) In-Reply-To: References: From: Gabriel Scherer Date: Mon, 19 Dec 2016 13:20:20 -0500 Message-ID: To: Ivan Gotovchits Cc: caml-list , Pierre Weis Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Deprecation of tabulation boxes You may be interested in the discussion https://github.com/ocaml/ocaml/pull/229 which discussed a few ways in which the proposed tabulation interface may be inconvenient. It is after this discussion that Pierre Weis decided to deprecate tabulation boxes -- I believe that the reason is that tabulation and formatting never mixed very well. Note that if you can decide in advance a maximal size for a given "column" of your formatted output, you can use the left or right-justification features of formatting conversions to print aligned text: let data = [("x", "foo"); ("loop", "bar")] let () = print_newline (); data |> List.iter (fun (lab, instr) -> Printf.printf "%5s: %s\n" lab instr) (* x: foo loop: bar *) let () = print_newline (); data |> List.iter (fun (lab, instr) -> Printf.printf "%-5s: %s\n" lab instr) (* x : foo loop : bar *) let () = let len = List.fold_left (fun m (lab, _) -> max m (String.length lab)) 0 data in print_newline (); data |> List.iter (fun (lab, instr) -> Printf.printf "%*s: %s\n" len lab instr) (* x: foo loop: bar *) On Mon, Dec 19, 2016 at 12:59 PM, Ivan Gotovchits wrote: > Greetings, > > The tabulation boxes are marked as deprecated since 4.03.0. I've tried to > google for > any reasons that justify the removal but found only a note by Pierre Weis in > the Matis issue tracker[1]: > > >> The proposed printf-like syntax is fine, but tabulation boxes are now >> deprecated. >> Indeed, tabulation boxes interaction with other pretty-printing boxes have >> never been sorted out and tabulation boxes usage is orthogonal to the rest >> of the Format module. >> If considered useful, tabulation boxes could be implemented out of the >> Format module. > > > First of all the tabulation boxes can't be implemented outside of the format > module since the tab stops are actually stored in the stack of tabulation > boxes. If this data field would be removed from the formatter we will need > to pass an extra argument to all pretty-printers that use the tabulation > break, or use some global variable. Neither solution can be considered > acceptable. > > Speaking about the usefulness. The tabulation boxes are useful for printing > assembly outputs. And since compiler writing is sort of an application area > for OCaml, it shouldn't be considered as a rare case. It is also very useful > for printing Fortran code, that can be considered an assembler for the > numeric computing. It also just allows printing nicely formatted texts, that > it the main purpose of the Format library. As an example, tabulation boxes > are used in BAP and CIL frameworks. > > To summarize, the deprecation will eventually make few project > non-compilable. And there is no clear substitution for the deprecated > feature. > > Given that, I would like to hear the justifications for the deprecation of > tabulation boxes and suggested workarounds. > > One possible workaround, that I could see, is making the `formatter` type > extensible with existential boxes or, more generally, with existential > attributes. In that case, we will indeed be able to implement tabulation > boxes outside of the format module. > > Best wishes, > Ivan Gotovchits > > [1]: https://caml.inria.fr/mantis/view.php?id=4665