caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Spiros Eliopoulos <seliopou@gmail.com>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] ANN: angstrom
Date: Mon, 25 Jul 2016 15:37:15 -0400	[thread overview]
Message-ID: <CAEkQQgJ-bQEPUew1B9eV9-24z3Zd_Ff8=do3uE3V6sbRPeK1Gw@mail.gmail.com> (raw)
In-Reply-To: <7DF0D33A403A4B41A5E2AAEAA6F6E06E@erratique.ch>

[-- Attachment #1: Type: text/plain, Size: 3205 bytes --]

On Mon, Jul 25, 2016 at 12:21 PM, Daniel Bünzli <daniel.buenzli@erratique.ch
> wrote:

> You are making a lot of assumptions about how the client should use the
> library or what humans are supposed to tolerate…

Nope, just one or two that seem pretty reasonable. First, there's not much
else a client of a parser can do with those errors without breaking
conceptual abstraction boundaries. Any action that a client would want to
take that wasn't logging properly belongs in the parser itself. A design to
the contrary would require the client of the parser to embody knowledge of
the parsing process itself, which defeats modularity, reuse, and ultimately
kills compositionality. So the only client assumption is that the client
finds these sorts of properties desirable.
Second, I'm well aware of human tolerances for feedback latency. Such
topics have been making the rounds in The New York Times, pop design books,
and the blogosphere for more than a decade now, so it's hardly an obscure
topic. I've also built and commercialized systems for application
performance management, which required a deep understanding of end-user
experience, business use cases, and operational practices.

The design I described has worst case failure reporting latency not
exceeding the latency of a successful parse. If you're exceeding those
latency tolerances at the parsing step, there is no hope of redemption for
the latency of the rest of your pipeline. And these aren't even
catastrophic failures. As you describe them they're, more or less, warnings.


> Giving back control to the client in case of error and allow it to restart
> the process allows to lift the constraints you put on the client.

While such a design sometimes benefits the system _as a whole_, it
certainly comes at a cost. In the case where clients are meant to
explicitly handle parse errors and restart the parse _through control
inversion_, the cost is the compositionality. That may be a worthwhile cost
to pay in some cases, but those cases have not yet revealed themselves to
me. On the other hand, Angstorm allows you to construct parsers
compositionally, and reuse them in just the same way. It even allows users
to design parsers that will report parse warnings, or even receive certain
kinds of errors are return a decision (that the parser is designed to
understand) about how to proceed. Whether or not that's a worthwhile design
is another question. I would say it's not but there's no accounting for
taste. For supporting composition, it's certainly better than control
inversion.

To bring it back, I think this discussion is focusing a bit too much on the
implementation of a single Angstrom parser, rather than the capabilities of
the library as a whole. Angstrom can suit the needs of many architectural
styles, whether its a "direct" style or "streaming" style, or that leads to
parsers that give clients fine-grained control over error recovery. It's a
parser combinator library, after all. Your parsers can do whatever you
design them to do, take whatever parameters they need to, and following a
few rules of thumb, still deliver good performance.

-Spiros E.

[-- Attachment #2: Type: text/html, Size: 3869 bytes --]

  reply	other threads:[~2016-07-25 19:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 13:35 Spiros Eliopoulos
2016-07-22 14:38 ` Daniel Bünzli
2016-07-22 21:46   ` Spiros Eliopoulos
2016-07-23  2:17     ` Daniel Bünzli
2016-07-23  6:41       ` Cole Brown
2016-07-23 11:37         ` Daniel Bünzli
2016-07-25 14:15       ` Spiros Eliopoulos
2016-07-25 15:44         ` Daniel Bünzli
2016-07-25 16:07           ` Spiros Eliopoulos
2016-07-25 16:21             ` Daniel Bünzli
2016-07-25 19:37               ` Spiros Eliopoulos [this message]
2016-07-25 20:03                 ` Daniel Bünzli
2016-10-13 12:42 ` Anil Madhavapeddy
2017-02-03 19:37 ` Hendrik Boom
2017-02-04 16:36   ` Spiros Eliopoulos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEkQQgJ-bQEPUew1B9eV9-24z3Zd_Ff8=do3uE3V6sbRPeK1Gw@mail.gmail.com' \
    --to=seliopou@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).