RedPRL / asai

🩺 A library for compiler diagnostics
https://ocaml.org/p/asai
Apache License 2.0
35 stars 2 forks source link

⏳ Buffering handler for accumulating diagnostics #185

Open favonia opened 3 weeks ago

favonia commented 3 weeks ago

This is another thing that could be helpful for many purposes.

mikeshulman commented 3 weeks ago

I assume you're thinking of this in relation to #160 and mikeshulman/narya#24. Reading #160 I also had the thought that this is maybe a natural abstraction. So as not to change the default behavior, my thought would be to have a buffer wrapper that intercepts diagnostics from its supplied continuation and accumulates them. Then after that continuation completes, it does something with the accumulated diagnostics, as specified by the other arguments it received, such as:

In addition, for my application I think I would also want:

And probably most of this behavior should be separately configurable for fatal and non-fatal diagnostics.

favonia commented 3 weeks ago

@mikeshulman Got it. And I am also thinking about thread-safety so that it can solve #151. Perhaps we should just have a domain-specific language for this...