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

Support thread-local/scoped color overrides #35

Open
jam1garner opened this issue Nov 1, 2021 · 1 comment
Open

Support thread-local/scoped color overrides #35

jam1garner opened this issue Nov 1, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@jam1garner
Copy link
Owner

jam1garner commented Nov 1, 2021

Moving this from #33 to its own issue.

One considered API design:

// color=always
scoped_override(true, || {
    // do stuff here?
});

// color=never
scoped_override(false, || {
    // do stuff here?
});

This would need to be behind a feature flag as it requires std for thread-local variables, but outside of that this isn't too bad. For the most part it should be able to reuse a lot of the code from #34, but replace the static with a thread local.

Outstanding Design Questions

  • Should scoped overrides or global overrides take precedence?
@sunshowers
Copy link
Collaborator

Should scoped overrides or global overrides take precedence?

I would personally expect that thread-local overrides, being more local than process-wide overrides, take precedence. (Similarly, task-local overrides should take precedence over thread-local ones I think)

@jam1garner jam1garner added the enhancement New feature or request label Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants