-
Notifications
You must be signed in to change notification settings - Fork 41
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
Contextualize scheme registration API #28
Comments
I'm generally down for this kind of contextualization, but I must say that I would not want it to happen this way. This kind of invokes a JavaScript-like, prototype-driven approach. The explicit context approach I prefer is typified in ashes, where there's a default context implicit. This is especially true in this case, where Anyways, in short, yes, but I definitely wouldn't want |
(renamed bc "localize" makes me think l10n ;) ) |
I'd be happy if we can avoid an import-time side effect. I'm always up for more dependency injection, and while a context object that encapsulates the scheme registry and that users can definitely avoids mutating global state, it presents its own design challenges:
|
hyperlink.register_scheme
mutates global state. That's convenient but amounts to an import time side effect. If I do this in modulea
:I have to do this in module
b
:Scheme registration should be localized, returning a new
URL
-like object that knows about the registered schemes. That would leta
look like this:So that
b
could do this:A context manager might be useful, too:
The text was updated successfully, but these errors were encountered: