Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⏳ Buffering handler for accumulating diagnostics #185

Open
favonia opened this issue Oct 31, 2024 · 2 comments
Open

⏳ Buffering handler for accumulating diagnostics #185

favonia opened this issue Oct 31, 2024 · 2 comments

Comments

@favonia
Copy link
Contributor

favonia commented Oct 31, 2024

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

@mikeshulman
Copy link
Collaborator

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:

  • packaging them into a single "bunched" diagnostic and emitting that for a handler further up the call stack to catch (which might itself be a buffering accumulator)
  • applying some user-specified filter to remove or modify some of them before doing the above, or perhaps nothing

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

  • a function that can be called from the continuation that inspects the diagnostics accumulated so far
  • a callback that the buffering handler executes on each diagnostic it receives to decide whether to accumulate it, ignore it, or immediately re-emit it for a higher handler

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

@favonia
Copy link
Contributor Author

favonia commented Oct 31, 2024

@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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants